Question

I am using the below function to update the post meta from the front end. How can I add add best a textarea that updates the_content() using wp_update_post()?

if ( isset( $_POST['albums'] ) && wp_verify_nonce($_POST['albums'],'update_albums_postmeta') ) 
    { //if nonce check succeeds.
        global $post;
        $postid = $post->ID;
        $data = $_POST['priceone'];
              update_post_meta($postid,'_releasedate',$data);
        $data = $_POST['pricetwo'];
              update_post_meta($postid,'_amazonlink',$data);
    }

-

Edit:

So this snippet is posting changes to the database, however when the page refreshes on-submit the old the_content() is being shown. The post must manually be refreshed to see the changes.

Is my snippet malformed?

if ( isset( $_POST['drw_inventory'] ) && wp_verify_nonce($_POST['drw_inventory'],'update_drw_postmeta') ) 
    { //if nonce check succeeds.
        global $post;
        $data_content = $_POST['description'];

        $my_post = array();
        $my_post['ID'] = $post->ID;
        $my_post['post_content'] = $data_content;
        wp_update_post( $my_post );
    }

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top