Having trouble using wp_update_post

I am trying to create an action that will place the contents of a meta tag into the excerpt field, but I can’t seem to get it right. The action is the publish event of a frontend submit plugin. When trying to submit, I get an error stating SyntaxError: Unexpected token < in JSON at position 0.

I am not sure how to troubleshoot this

Here is my code:

add_action(‘dpform_actions’, ‘dp_offer_to_excerpt’);

function dp_offer_to_excerpt() {
$dp_offer = get_post_meta( get_the_ID(), ‘offer_product’ );
$id = get_the_ID();
$my_post = array(
‘ID’ => $id,
‘post_excerpt’ => $dp_offer,
wp_update_post( $my_post );


Read more here:: Having trouble using wp_update_post

Leave a Reply

Your email address will not be published. Required fields are marked *