WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#12842 closed defect (bug) (fixed)

Future dated custom posts miss schedule

Reported by: waltervos Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: has-patch dev-feedback needs-review
Focuses: Cc:

Description

My installation of WP3 has absolutely no problem with future dated regular posts, but when future dating a custom post type the custom post misses schedule each and every time. I have absolutely no clue as to where things go wrong.

Here's the code I'm using:

add_action( 'init', 'twms_register_post_types', 100 );
function twms_register_post_types() {
    register_post_type('tweet', array(
        'label' => __('Tweets'),
        'singular_label' => __('Tweet'),
        'public' => true,
        'exclude_from_search' => false,
        'supports' => array(
            'title'
        )
    ));
}

Attachments (1)

12842.diff (1.3 KB) - added by waltervos 9 years ago.
Removes default hooking _future_post_hook to future_post and future_page and moves it to register_post_type

Download all attachments as: .zip

Change History (10)

#1 @waltervos
9 years ago

  • Summary changed from Future dated custom posts mis schedule to Future dated custom posts miss schedule

#2 @waltervos
9 years ago

Some additional info: I checked out the cron value in the wp_options table and there is no event scheduled for any of my future dated custom posts.

@waltervos
9 years ago

Removes default hooking _future_post_hook to future_post and future_page and moves it to register_post_type

#3 @waltervos
9 years ago

The problem was the following:

In wp-includes/default-filters.php the function _future_post_hook is hooked to future_post and future_page. This assumes that there are no other post types. In my patch I deleted the lines that do this and added the line

add_action( 'future_' . $post_type, '_future_post_hook', 5, 2 );

to the register_post_type function. This takes care of future post capability for any post type that's created. This seemed like the most elegant way of doing this.

#4 @waltervos
9 years ago

  • Keywords has-patch needs-testing added

#5 @waltervos
9 years ago

  • Keywords custom post types future dating posts scheduling cron scheduled posts removed

#6 @waltervos
9 years ago

  • Keywords needs-testing removed

#7 @waltervos
9 years ago

  • Keywords needs-feedback added

Could someone take a look at this please?

#8 @waltervos
9 years ago

  • Keywords dev-feedback needs-review added; needs-feedback removed

#9 @dd32
9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14056]) Handle future-scheduled custom post_type's. Props waltervos. Fixes #12842

Note: See TracTickets for help on using tickets.