WP_UPDATE_POST () Esempio ... come aggiornare il_content in un TextArea?
-
30-10-2019 - |
Domanda
Sto usando la funzione seguente per aggiornare il Meta post dalla parte anteriore. Come posso aggiungere aggiungi il meglio di textarea che si aggiorna the_content()
usando 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);
}
-
Modificare:
Quindi questo snippet sta pubblicando modifiche al database, tuttavia quando la pagina si aggiorna sulla vecchia the_content()
viene mostrato. Il post deve essere aggiornato manualmente per vedere le modifiche.
Il mio frammento è malformato?
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 );
}
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange