Add a simple JS Alert Box on Post Submission

Note that when post is update WordPress redirect you from /wp-admin/post.php to /wp-admin/post.php?post=41&action=edit which mean it loads twice. Thus what you will do on transition status hooks that will be skipped before the content is printed. Solution:- In transition hook callback function store (post meta) some flag to display js popup Bind a new function … 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

Include Drafts or Future posts with count_user_posts?

This will do what you want: $args = array( ‘author’ => $curauth->ID, ‘post_status’ => array( ‘publish’, ‘pending’, ‘draft’, ‘future’ ) ); $posts = new WP_Query(); $post_count = $posts->found_posts; It will include drafts, pending posts, published posts, and future posts. There are more you can set, such as trashed posts, and private posts, but that didn’t … Read more

Changing post status

That code is part of something bigger, as there are many places where the custom post_status needs to be inserted. There are two interesting discussions here at WPSE and both point to the use of this plugin: Edit Flow. Is it possible to have more “levels” of draft/published statuses? Add a new post status in … Read more