Changeset 6985

Show
Ignore:
Timestamp:
02/22/08 19:59:12 (9 months ago)
Author:
ryan
Message:

Make sure post has future status before publishing from cron. Props hailin. fixes #5801

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/default-filters.php

    r6974 r6985  
    161161add_action('wp_head', 'wlwmanifest_link'); 
    162162add_action('wp_head', 'locale_stylesheet'); 
    163 add_action('publish_future_post', 'wp_publish_post', 10, 1); 
     163add_action('publish_future_post', 'check_and_publish_future_post', 10, 1); 
    164164add_action('wp_head', 'noindex', 1); 
    165165add_action('wp_head', 'wp_print_scripts'); 
  • trunk/wp-includes/post.php

    r6983 r6985  
    13941394} 
    13951395 
     1396/** 
     1397 * check_and_publish_future_post() - check to make sure post has correct status before 
     1398 * passing it on to be published. Invoked by cron 'publish_future_post' event 
     1399 * This safeguard prevents cron from publishing drafts, etc.  
     1400 *  
     1401 * {@internal Missing Long Description}} 
     1402 * 
     1403 * @package WordPress 
     1404 * @subpackage Post 
     1405 * @since 2.5 
     1406 * @uses $wpdb 
     1407 * 
     1408 * @param int $post_id Post ID 
     1409 * @return int|null {@internal Missing Description}} 
     1410 */ 
     1411function check_and_publish_future_post($post_id) { 
     1412     
     1413    $post = get_post($post_id); 
     1414 
     1415    if ( empty($post) ) 
     1416        return; 
     1417 
     1418    if ( 'future' != $post->post_status ) 
     1419        return; 
     1420 
     1421    return wp_publish_post($post_id);  
     1422} 
     1423 
    13961424function wp_add_post_tags($post_id = 0, $tags = '') { 
    13971425    return wp_set_post_tags($post_id, $tags, true);