WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] Publish scheduled/future posts in 3.5 (11 posts)

  1. THE MOLITOR
    Member
    Posted 1 year ago #

    Hi there,

    I'm using the following code in my functions.php file that sets posts with a future publish date to the "published" status (instead of "scheduled").

    Everything worked perfect until updating to WordPress 3.5. Does anybody know why?...

    function setup_future_hook() {
     // Replace native future_post function with replacement
     remove_action('future_post', '_future_post_hook');
     add_action('future_post', 'publish_future_post_now');
    }
    
    function publish_future_post_now($id) {
     // Set new post's post_status to "publish" rather than "future."
     wp_publish_post($id);
    }
    
    add_action('init', 'setup_future_hook');
  2. tomontoast
    Member
    Posted 1 year ago #

  3. tomontoast
    Member
    Posted 1 year ago #

    Looking more in detail at http://wpseek.com/_future_post_hook/ it seems that you may need

    function setup_future_hook() {
     // Replace native future_post function with replacement
     remove_action('future_post', '_future_post_hook');
     add_action('future_post', 'publish_future_post_now');
    }
    
    function publish_future_post_now($deprecated,$id) {
     // Set new post's post_status to "publish" rather than "future."
     wp_publish_post($id);
    }
    
    add_action('init', 'setup_future_hook');
  4. Andrew Nacin
    Lead Developer
    Posted 1 year ago #

    Interesting. wp_publish_post() used to do a direct database call. It was updated to use wp_update_post() in 3.5. The side effect is that it no longer forcibly publishes a post that is dated in the future. I am not sure whether pre-3.5, or post-3.5, should be considered expected behavior. Relevant Trac ticket, https://core.trac.wordpress.org/ticket/21963, and commit, https://core.trac.wordpress.org/changeset/21942.

    Try this as a workaround:

    remove_action('future_post', '_future_post_hook');
    add_filter( 'wp_insert_post_data', 'nacin_do_not_set_posts_to_future' );
    function nacin_do_not_set_posts_to_future( $data ) {
        if ( $data['post_status'] == 'future' && $data['post_type'] == 'post' )
            $data['post_status'] = 'publish';
        return $data;
    }
  5. THE MOLITOR
    Member
    Posted 1 year ago #

    Nacin, you are the man.

  6. shacker
    Member
    Posted 1 year ago #

    Thanks a bunch Andrew Nacin! I've updated the repo with your version, which should be compatible with all WP versions.

    http://wordpress.org/extend/plugins/the-future-is-now/

  7. sLa NGjI's
    Member
    Posted 1 year ago #

    Scheduled posts regression is high WordPress 3.5 bug, correct on WordPress 3.5.1-beta1!

    WP Missed Schedule correct exactly ticket #22944 and others related issues of WordPress since version 2.6 ;) ignored from core team ...

    Upgrade to WordPress 3.5.1-beta1 or install my plugin WP Missed Schedule ;)

  8. stephenmed
    Member
    Posted 1 year ago #

    OMG!!! You don't know how long Ive been trying to fix this. Loaded the-future-is-now and it orked like a charm. Bought a template a week ago and haven't been able to get it to work. Support seemed lost so I guess they owe you a thanks too.

  9. okadots
    Member
    Posted 1 year ago #

    did this stop working in 3.5.2??

    i can't get it to work at all - i even tried installing the "the future is now" plugin.

  10. Linda Lee
    Member
    Posted 1 year ago #

    This has stopped working for several of my clients as well.
    Is it a WP issue? Is there a fix coming?

  11. esmi
    Forum Moderator
    Posted 1 year ago #

    Nope. There are no known scheduling issues in WordPress 3.5.

    As this topic is over 7 months old, I am now closing it.

Topic Closed

This topic has been closed to new replies.

About this Topic