Show scheduled posts in archive page

I’d like my archive.php page’s daily view (is_day) to display scheduled posts (post_status=future). For example, if I go to mysite.com/2011/05/20 I would see all posts scheduled to appear on May 20. The archive page’s loop starts with: if ( have_posts() ) the_post(); and ends with: rewind_posts(); get_template_part( ‘loop’, ‘archive’ ); Do I need to make … Read more

Enable commenting on front-end preview page for pending posts

We are in the process of allowing authors to collaboratively be a part of the editorial process. They will have access to all pending posts’ preview pages (not post-edit pages). I want to allow these users to post a normal comment whenever the post is in pending post_status. Upon research, a comprehensive solution has been … Read more

Can’t get drafts with WP_Query using post_status parameter

I can’t seem to get drafts to show up with WP_Query, even when post_status is set to ‘any’ or ‘draft’ $args = array( ‘p’ => 1234, ‘post_type’ => ‘any’, ‘post_status’ => ‘any’ ); $query = new WP_Query( $args ); while ( $query->have_posts() ) : $query->the_post(); // display the post endwhile; wp_reset_postdata(); If I go back … Read more

‘transition_post_status’ only fires when pressing “Add New”

I want to fire a function when a new post (cpt) is published. function my_publish( $new_status, $old_status, $post ) { if ( $new_status == ‘publish’ && ‘publish’ !== $old_status ) { // do s.th. } debug_to_console( $post ); } add_action( ‘transition_post_status’, ‘my_publish’, 10, 3 ); So when I hit the “Add New” button, the function … Read more

How do I batch create revisions of all posts?

I cleaned up an old-site from pasted tags, manually created lists, etc, and I’d like to keep the old posts as “revisions”, so we can easily “compare” with the old posts and retrieve/revert the original content if needed. So I should either injecting the revision rows in the new DB or just naturally create them … Read more

Can not get future_to_publish to work

I’m trying to figure out why future_to_publish will not work. Here is a list of what I have checked to work: draft_to_publish future_post publish_post transition_post_status (works draft to future, but not future to publish) I can’t seem to figure out the problem. I’ll include the test code I’m using below: function on_post_scheduled( $ID, $post ) … Read more

1 day after custom date change post status to draft

1 day after koncerter_start_date all posts with custom-post-type koncert have to get the status draft 1 Answer 1 Your question isn’t very clear. Do you mean: 1 day after koncerter_start_date all posts with custom-post-type koncert have to get the status draft? EDIT Code: add_action( ‘wp_loaded’, ‘concert_daily_tasks’ ); function concert_daily_tasks() { $current_url = “https://” . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; if ( $current_url … Read more