• Resolved darkwolf74

    (@darkwolf74)


    wp_update_post is being called from within the loop (via loop.php) to update the author ID of posts during certain cases, but is not updating the author.

    if ($BLAH) {
    $temp[results] = wp_update_post(array('ID' => $post->ID, 'post_author' => '10'));
    echo "Updated ",$post->ID," with an author of '10'.. Was set to ",$post->post_author,"<br>"; print_r($temp[results]);
    }

    Debug returned from the above echo is:

    Updated 42971 with an author of ’10’.. Was set to 11
    42971

    wp_update_post is returning the post->ID on execution, but post_author is unchanged.

    Any help on this would be great. This is a short order project and the deadline is, well, days ago. I’m hung up and pulling out my hair.

    I also tried a simple MySQL UPDATE statement of UPDATE wp_posts SET post_author=’10’ WHERE ID = ‘###’; but calling via $wpdb->query returns 0 – However a run of the statement inside PHP My Admin changes the value and returns 1.

    I’m perplexed.

Viewing 1 replies (of 1 total)
  • Thread Starter darkwolf74

    (@darkwolf74)

    Cancel that.. Stupid me, I had a DB change statement that selected the live DB instead of the devel DB. Turns out, it was changing it on THERE instead.

    Closed.

Viewing 1 replies (of 1 total)

The topic ‘wp_update_post not updating’ is closed to new replies.