![](/img/trans.png)
[英]get_post_meta and add_post_meta not working in wordpress
[英]add_post_meta() is not working
希望你們今天做得好。 :)
我在函數中使用了add_post_meta()和update_post_meta() ,但是add_post_meta()函數和update_post_meta都沒有。
這是代碼。
$post_id = $_POST['post_id'];
add_post_meta($post_id, 'counter_meta', 'Dani');
$return = get_post_meta($post_id, 'counter_meta', true );
echo '<pre>';
print_r($return);
exit;
它沒有回報:(
我在id進入post_id
變量之前檢查過。
任何幫助。?
采用
$post_id = $post->ID;
add_post_meta($post_id, 'counter_meta', 'Dani');
$return = get_post_meta($post_id, 'counter_meta', true );
echo '<pre>';
print_r($return);
exit;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.