add_filter('rwmb_meta_boxes', 'your_prefix_meta_boxes');
function your_prefix_meta_boxes($meta_boxes) {
$meta_boxes[] = array(
'title' => __('Test Meta Box', 'textdomain'),
'post_types' => 'post',
'fields' => array(
array(
'id' => 'name',
'name' => __('Name', 'textdomain'),
'type' => 'text',
),
array(
'id' => 'gender',
'name' => __('Gender', 'textdomain'),
'type' => 'radio',
'options' => array(
'm' => __('Male', 'textdomain'),
'f' => __('Female', 'textdomain'),
),
),
array(
'id' => 'email',
'name' => __('Email', 'textdomain'),
'type' => 'email',
),
),
);
return $meta_boxes;
}
我把pud這個代碼放在我的function.php中,我在添加新的帖子只是添加meta box。我的網頁上也需要meta box。請幫助我添加meta框只出現在添加新帖子中沒有出現在頁面
' 'post_types'=>陣列( '後', '頁面'),' –
如何爲特定頁面 –
https://metabox.io/docs/meta要這樣做-box-include-exclude/ –