我正在创建一个包含多个自定义字段的自定义帖子。为自定义字段输入的值包含单引号时,其后的所有内容都将被删除。是否有一个过滤器可用于转义引号,以便它们作为字符串的一部分读入?
我有很多自定义字段,但这里以我正在使用的代码为例。
// prefix of meta keys, optional
// use underscore (_) at the beginning to make keys hidden, for example $prefix = '_rw_';
// you also can make prefix empty to disable it
$prefix = 'rw_';
$meta_boxes = array();
// first meta box
$meta_boxes[] = array(
'id' => 'entry_data', // meta box id, unique per meta box
'title' => 'Entry Data', // meta box title
'pages' => array('dictionary_entry'), // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'high', // order of meta box: high (default), low; optional
'fields' => array( // list of meta fields
array(
'name' => 'Definition 1', // field name
'desc' => 'What does this mean?', // field description, optional
'id' => $prefix . 'definition1', // field id, i.e. the meta key
'type' => 'text', // text box
'std' => '', // default value, optional
'validate_func' => 'check_name' // validate function, created below, inside RW_Meta_Box_Validate class
),
array(
'name' => 'Example 1', // field name
'desc' => 'Use it in a sentence?', // field description, optional
'id' => $prefix . 'example1', // field id, i.e. the meta key
'type' => 'text', // text box
'std' => '', // default value, optional
'validate_func' => 'check_name' // validate function, created below, inside RW_Meta_Box_Validate class
),
)
);