WordPress.org

Ready to get started?Download WordPress

Forums

wp_update_post() not working (2 posts)

  1. blue-eyed-devil
    Member
    Posted 2 years ago #

    I want to update post content via third party plugin but it don't work for me I don't know why. My code is:

    $new_content = array(
    'ID' => $post_id,
    'post_content' => $article
    );

    wp_update_post( $new_content );

    This code is inside function which is inside a class

  2. Bob Gregor
    Member
    Posted 1 year ago #

    Where do you define $post_id?

    Also, the problem looks to be that you don't have enough info in the $new_content array, I'd recommend looking at the defaults specified in the source for wp_update_post.

Topic Closed

This topic has been closed to new replies.

About this Topic