Ticket #5801: 755_future_posts_wporg.diff

File 755_future_posts_wporg.diff, 1.8 kB (added by hailin, 10 months ago)

updated patch with ryan's feedback

  • C:/xampp/htdocs/wordpress_trunk/wp-includes/default-filters.php

    old new  
    153153add_action('wp_head', 'rsd_link'); 
    154154add_action('wp_head', 'wlwmanifest_link'); 
    155155add_action('wp_head', 'locale_stylesheet'); 
    156 add_action('publish_future_post', 'wp_publish_post', 10, 1); 
     156add_action('publish_future_post', 'check_and_publish_future_post', 10, 1); 
    157157add_action('wp_head', 'noindex', 1); 
    158158add_action('wp_head', 'wp_print_scripts'); 
    159159add_action('wp_head', 'wp_generator'); 
  • C:/xampp/htdocs/wordpress_trunk/wp-includes/post.php

    old new  
    12591259        do_action('wp_insert_post', $post_id, $post); 
    12601260} 
    12611261 
     1262/** 
     1263 * check_and_publish_future_post() - check to make sure post has correct status before 
     1264 * passing it on to be published. Invoked by cron 'publish_future_post' event 
     1265 * This safeguard prevents cron from publishing drafts, etc.  
     1266 *  
     1267 * {@internal Missing Long Description}} 
     1268 * 
     1269 * @package WordPress 
     1270 * @subpackage Post 
     1271 * @since 2.5 
     1272 * @uses $wpdb 
     1273 * 
     1274 * @param int $post_id Post ID 
     1275 * @return int|null {@internal Missing Description}} 
     1276 */ 
     1277function check_and_publish_future_post($post_id) { 
     1278         
     1279        $post = get_post($post_id); 
     1280 
     1281        if ( empty($post) ) 
     1282                return; 
     1283 
     1284        if ( 'future' != $post->post_status ) 
     1285                return; 
     1286 
     1287        return wp_publish_post($post_id);  
     1288} 
     1289 
    12621290function wp_add_post_tags($post_id = 0, $tags = '') { 
    12631291        return wp_set_post_tags($post_id, $tags, true); 
    12641292}