Skip to content

Instantly share code, notes, and snippets.

View nateplusplus's full-sized avatar
💭
Groovin'

Nathan Blair nateplusplus

💭
Groovin'
View GitHub Profile
@nateplusplus
nateplusplus / password_protect_posts.php
Last active March 24, 2020 19:41 — forked from pablo-sg-pacheco/functions.php
Wordpress - Password protect a custom post type programmatically
<?php
//Password Protect programmatically
function passwordProtectPosts( $post_object ) {
//Checks if current post is a specific custom post type
if ( $post_object->post_type !== 'tutorial' ) {
return;
}
$post_object->post_password = 'your_password';