How to 301 private posts rather than 404?

How do I 301 redirect private pages, rather than 404 them? If a post is private, WordPress filters it out in the SQL query, so there are no $post variables to work with. I’d like for this code to work, but doesn’t: add_action(‘wp’,’redirect_stuffs’, 0); function redirect_stuffs(){ global $post; if ( $post->post_status == “private” && !is_admin() … Read more

How can I run custom function when post status is changed?

I can hook custom function to each of trash_post, edit_post, private_to_publish etc. to meet some of my requirements, but I need also to check for more possible transitions like ‘pending to draft’, ‘private to draft’ and so on. Something similar to this inexistent function: if( post_status_changed($post_id) ) { my_custom_function(); } 1 1 See this Codex … Read more

Let private posts stay in status “private” after edit through “editors”

I’m using some private posts for intern purposes. When an editor changes something on these posts, its status turns to pending “review” and I have to publish it again as a private post. When an editor changes something on a normal page/post – that has already been published for public – the status doesn’t change, … Read more

How to display the status of users (online – offline) in archive.php

I am using the code the user status How to check if a user (not current user) is logged in?. On page profile of the author it works well (thank you guys). But if I put on the archive page, at the bottom of the post, it does not work. functions.php add_action(‘wp’, ‘update_online_users_status’); function update_online_users_status(){ … Read more

How to change “Draft” string for status of custom post type to “Unavailable”?

ANSWER MOD: just an important mod to the chosen answer: // check if you actually have drafts; also avoids extra ‘|’ separator if (isset($views[‘draft’])) { // ‘Drafts’ should be added (and come first) if you don’t want to end up with ‘Unavailables’ $views[‘draft’] = str_replace(array(‘Drafts’,’Draft’), ‘Unavailable’, $views[‘draft’]); } and the mentioned caveat is not showing … Read more

Changing post status in one click

I want to add custom button “Send for correction” somewhere near the “Publish” button. This custom button must change a post status from “Pending” to my own created status named “On correction”. For a now it is possible to change status with 5 clicks (Edit status -> Dropdown click -> Select On-correction -> Ok -> … Read more

register_post_status and show_in_admin_all_list

I have a custom post status which should be public visible but not displayed in the “all” list of the edit screen. This is how I register the post status: register_post_status(‘my_custom_post_status’, array( ‘label’ => __(‘The Label’, ‘domain’), ‘public’ => true, ‘exclude_from_search’ => true, ‘show_in_admin_all_list’ => false, ‘label_count’ => //blablabla )); The show_in_admin_all_list = false should … Read more

Custom column for changing post status via ajax

I’m currently trying to implent a new custom column at the page manage screen that will let me change the status (published/pending) of the different pages via an easy toggle link. From what I’ve gathered I need to use $post->post_status, ‘status‘in someway, probably toggle with jQuery or something. But I can’t figure out how I … Read more