Inserting content from custom field to post_content


What am I doing wrong here?

I’m using a theme that uses a custom field (“listing_seller_note”) to save input from our user post types, and I’d like to insert this content into the post_content field whenever a post is saved/updated.

Currently the code just seems to time out rather than run properly – no errors or anything.

Here’s the code in functions.php:

add_action( 'save_post', 'add_notes_to_content', 100, 2 );

function add_notes_to_content( $post_id, $post ) {
    $listing        = get_post( $post_id );
    $note           = get_post_meta( $post->ID, 'listing_seller_note', true );

    $post_update = array(
        'ID'         => $post->ID,
        'post_content' => $note
        wp_update_post( $post_update );
, , Worries 3 years 2020-08-25T16:10:18-05:00 0 Answers 43 views 0

Leave an answer