Show scheduled posts in archive page

Keep things simple – leave your archive templates alone and place this in your functions.php; add_action( ‘pre_get_posts’, function ( $wp_query ) { global $wp_post_statuses; if ( ! empty( $wp_post_statuses[‘future’] ) && ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_date() || $wp_query->is_single() ) ) { $wp_post_statuses[‘future’]->public = true; } }); Essentially, it says; If we’re on a … Read more

Adding custom post status to visibility in publish meta box

I also don’t see a way to edit that form in that location, though there is a hook called post_submitbox_misc_actions near the bottom. I strongly suggest that use that post_submitbox_misc_actions hook or add your own brand new meta_box to the page. There are potentially severe consequences to altering the default meta_boxes, especially that one. However… … Read more

Custom Post Status not showing in Custom Post Type ALL view

You should set the public argument to true. This way the post with ‘inpacking’ or ‘sent’ post_status will also show in total. So your code should be like this: register_post_status( ‘inpacking’, array( ‘label’ => _x( ‘In Packing’, ‘Order packing’ ), ‘public’ => true, ‘exclude_from_search’ => false, ‘show_in_admin_all_list’ => true, ‘show_in_admin_status_list’ => true, ‘label_count’ => _n_noop( … Read more

How to change post status in hook?

You get the full post object as a second parameter on save_post. Use it to change the status just like the following code. add_action( ‘save_post’, ‘wpse_78351_status’, 10, 2 ); function wpse_78351_status( $post_ID, $post ) { remove_filter( current_filter(), __FUNCTION__ ); if ( ‘trash’ !== $post->post_status ) //adjust the condition { $post->post_status=”draft”; // use any post status … Read more

Get a list of ALL Statuses both registered and built-in

This largely depends on where within the boot/request sequence you decide to make an attempt at retrieving statuses and it also depends on whether someone, thing, plugin or theme is doing something, funky, or not but the latter is less likely the case. Useful API functions: get_post_statuses docs | source Retrieves statuses for the built … Read more

Using arbitrary post status without registering it

I’m pretty sure only attachments have post status “enforcement” (“inherit” or “private”), and that’s only inside wp_insert_attachment(). Otherwise there’s no cron action or routine I’m aware of that’ll change stati. I still think you should opt for registering it though. Without any arguments, everything will still behave the way it does currently; they won’t appear … Read more

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