Change Visibility to Private

You were pretty close. You just want to hook in at the right time when the comment is being saved. This is untested but should work. add_action( ‘comment_post’, ‘wpse_make_private_after_3_comments’, 10, 2 ); function wpse_make_private_after_3_comments( $comment_ID, $comment_approved ) { $comment = get_comment( $comment_ID ); $post_ID = $comment->comment_post_ID; $comments = wp_count_comments( $post_ID ); // You could also … Read more

query private custom post type

If you are setting the CPT to private, that is telling wordpress not to create the dynamic page for that post type. This includes using the single-CPT.php file. If you want to have “?post_type=” pages, you’ll need to set the cpt to publicly_queryable=true, or public=true (which includes publicly_queryable). Why do you want it private (aka … Read more

View Private Published Page with URL Code (no login required)

You can actually hook the built-in page/post password feature and set it up to check for url params that match page/post password, and then change the value of $required to false. add_filter( ‘post_password_required’, ‘my_allow_url_param’, 10, 2 ); function my_allow_url_param( $required, $post ) { if ( empty( $post->post_password ) ) { $required = false; return $required; … Read more

List Category Posts not showing posts marked private to logged-in users

List Category Posts plugin uses get_posts to actually get the posts and its default post_status is publish and that is way you won’t get any private posts. To “Fix” it you can edit the file named include/CatList.php of the plugin and add $lcp_query .= ‘&post_status=private’; before line 51 before $this->lcp_categories_posts = get_posts($lcp_query); this will get … Read more

Private Posts/Pages & Search

This is the default WordPress behavior. http://codex.wordpress.org/Content_Visibility#Private_Content Private posts are automatically published but not visible to anyone but those with the appropriate permission levels (Editor or Administrator). WARNING: If your site has multiple editors or administrators, they will be able to see your protected and private posts in the Edit panel. If you want to … Read more

Can we have private drafts?

I would probably create a custom field / check box for this for a draft stage. Then hook into post status transition (or around) and when post is published force it to only private, even if normal publish was pressed. From personal experience custom post statuses are a wreck. They seem like a good idea, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)