Exemple wp_update_post ()… comment mettre à jour le_content dans un textarea?

wordpress.stackexchange https://wordpress.stackexchange.com/questions/22237

  •  30-10-2019
  •  | 
  •  

Question

J'utilise la fonction ci-dessous pour mettre à jour la méta du post à l'avant. Comment puis-je ajouter d'ajouter le meilleur de Textarea qui met à jour the_content() utilisant 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);
    }

-

Éditer:

Donc, cet extrait publie des modifications à la base de données, mais lorsque la page se rafraîchit sur l'ancien the_content() est montré. Le message doit être rafraîchi manuellement pour voir les modifications.

Mon extrait est-il malformé?

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 );
    }

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange
scroll top