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

Add Post Status to Body Class

You’ll have to use the body_class hook in the functions.php file of your theme in combination with get_post_status() function. Like the following: add_filter( ‘body_class’, ‘custom_class’ ); function custom_class( $classes ) { if ( get_post_status() == ‘rejected’ ) { $classes[] = ‘rejected’; } return $classes; }

How can I set a Post’s default visibility to private and pending review checked

Found this snippet after more searching: //Force posts of custom type to be private //…but first make sure they are not ‘trash’ otherwise it is impossible to trash a post function force_type_private($post) { if (($post[‘post_type’] == ‘post’) { if ($post[‘post_status’] != ‘trash’) $post[‘post_status’] = ‘private’; } return $post; } add_filter(‘wp_insert_post_data’, ‘force_type_private’); Changed the boolean to: … Read more

Modify Post Status Arguments

You can alter a post status after init by changing the global variable $wp_post_statusses: function alt_post_status() { global $wp_post_statuses; $wp_post_statuses[‘custom_status’]->public = true; } add_action( ‘init’, ‘alt_post_status’ ); register_post_status() (line 922) does the same thing: … global $wp_post_statuses; if (!is_array($wp_post_statuses)) $wp_post_statuses = array(); // Args prefixed with an underscore are reserved for internal use. $defaults = … Read more

“Publish immediately” with custom post status

Few notes We can get the “Publish immediately” notice within the post_submit_meta_box(() when the post_date_gmt is equal to ‘0000-00-00 00:00:00’. We can see here within wp_update_post() and here and here within wp_insert_post(), how draft-, pending- or auto-draft posts are not date stamped. It looks like if we had a filter on the post status array … Read more

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