wp_update_post()例…テキストアレアで_contentを更新する方法は?
-
30-10-2019 - |
質問
以下の関数を使用して、フロントエンドからポストメタを更新しています。更新するTextareaを最適に追加するにはどうすればよいですか the_content()
使用 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);
}
-
編集:
したがって、このスニペットはデータベースの変更を投稿していますが、ページが古いものをリフレッシュすると、古いものが the_content()
表示されています。変更を確認するには、投稿を手動で更新する必要があります。
私のスニペットは奇形ですか?
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 );
}
正しい解決策はありません
所属していません wordpress.stackexchange