我正在使用下面的函数从前端更新post meta。如何添加最佳添加文本区域以更新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);
}
-Edit:
因此,此代码段将更改发布到数据库中,但是当页面在提交旧的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 );
}