SyndicatedPost::fix_revision_meta PHP Méthode

fix_revision_meta() public méthode

In their infinite wisdom, the WordPress coders seem to have made it completely impossible for a plugin that uses wp_insert_post() to set certain meta-data (such as the author) when you store an old revision of an updated post. Instead, it uses the WordPress defaults (= cur. active user ID if the process is running with a user logged in, or = #0 if there is no user logged in). This results in bogus authorship data for revisions that are syndicated from off the feed, unless we use a ridiculous kludge like this to end-run the munging of meta-data by _wp_put_post_revision.
public fix_revision_meta ( integer $revision_id )
$revision_id integer The revision ID to fix up meta-data
    function fix_revision_meta($revision_id)
    {
        global $wpdb;
        $post_author = (int) $this->post['post_author'];
        $revision_id = (int) $revision_id;
        // Let's fix the author.
        set_post_field('post_author', $this->post['post_author'], $revision_id);
        // Let's fix the GUID to a dummy URL with the update hash.
        set_post_field('guid', 'http://feedwordpress.radgeek.com/?rev=' . $this->update_hash(), $revision_id);
        // Let's fire an event for add-ons and filters
        do_action('syndicated_post_fix_revision_meta', $revision_id, $this);
    }