Ticket #1257: fix-permalink-in-outgoing-pings.diff

File fix-permalink-in-outgoing-pings.diff, 1.3 KB (added by markjaquith, 7 years ago)

Patch for /branches/1.5/

  • post.php

     
    188188 
    189189        add_meta($post_ID); 
    190190 
     191        // Set the permalink regardless of post status so drafts have a valid link in the preview 
    191192        $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'"); 
    192193 
    193194        do_action('save_post', $post_ID); 
    194195 
    195196        if ('publish' == $post_status) { 
     197                // Bust the post cache to make sure permalinks work 
     198                global $post_cache; 
     199                if (isset($post_cache[$post_ID])) 
     200                        unset($post_cache[$post_ID]); 
     201 
     202                $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'"); 
     203 
    196204                do_action('publish_post', $post_ID); 
    197205                if ($post_pingback) 
    198206                        register_shutdown_function('pingback', $content, $post_ID); 
     
    432440        do_action('edit_post', $post_ID); 
    433441 
    434442        if ($post_status == 'publish') { 
     443                // Bust the post cache to make sure permalinks work 
     444                global $post_cache; 
     445                if (isset($post_cache[$post_ID])) 
     446                        unset($post_cache[$post_ID]); 
     447 
     448                $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'"); 
     449 
    435450                do_action('publish_post', $post_ID); 
    436451                register_shutdown_function('do_trackbacks', $post_ID); 
    437452                register_shutdown_function('do_enclose', $content, $post_ID );