How do I check if a posts status is set to draft or pending?

I would like to check a posts status, in particular I want to know if a post is set to draft or is privately published. I have the following code: if (‘draft’ != get_post_status() || is_user_logged_in()) { $this->render(); } else { wp_redirect( site_url(‘404’) ); exit; } It checks to see if a posts status is … Read more

How to change post status in hook?

I have similar problem as described in How to trap “Publish” button to check for meta box validation? Answer there is to hook into save_post and change post type. How can I do it? I try to use wp_transition_post_status but it doesn’t work for me… function myHook( $post_ID, $post ) { wp_transition_post_status(‘pending’, $post->post_status, $post ); … Read more

get_terms(); show private posts when logged in

Hi have a custom post type “FAQ”. I got some “FAQ’s” that are private, also only visible for logged in users. I used “get_terms()” funktion for a widget that is listing links to the categories of those “FAQ’s”. The “get_terms” does not list the terms, that have only private “FAQ’s”. $taxonomy = ‘faq_kategorien’; $tax_terms = … Read more

Custom post status and preview

I am using wordpress 3.4 (the last before 3.5) and I have declared a post status type, and a custom user role called agent. It is for a custom post type, property. register_post_status( ‘purchased’, array( ‘label’ => _x( ‘Purchased’, ‘post’ ), ‘public’ => false, ‘exclude_from_search’ => true, ‘show_in_admin_all_list’ => true, ‘show_in_admin_status_list’ => true, ‘label_count’ => … Read more

WP_Post_List_Table::get_views – Have post counts account for filters?

Toward the top of the edit.php screens there is a list that displays post statuses along with the post count. I believe this is generated by WP_Post_List_Table::get_views. For example All (7) | Published (6) | Draft (1) Unfortunately, those post counts do not respect filters. I am using pre_get_posts to exclude certain posts. Even though … Read more