在我们用wordpress做网站的时候,存储自定义数据,需要用到custom fields,也就是自定义字段。不过,我们在提供给用户使用后台的时候,不能向他们展示custom fields框,一是让用户理解这要怎么用会比较麻烦,二是没有一个友好的界面,使用起来并不方便。
所以,我们在默认情况下,是隐藏掉custom fields框的。
怎么取消掉呢,后台的custom fields框,也是一种meta box,在remove_meta_box函数里有介绍:
remove_meta_box( $id, $page, $context );
$id
(string) (required) Value of the id attribute of the HTML element to remove. Some of the available id values are given below:
‘authordiv’ – Author metabox
‘categorydiv’ – Categories metabox.
‘commentstatusdiv’ – Comments status metabox (discussion)
‘commentsdiv’ – Comments metabox
‘formatdiv’ – Formats metabox
‘pageparentdiv’ – Attributes metabox
‘postcustom’