我在编辑链接页面添加了一个元框&无论我在该字段中放置了什么,我都无法保存数据。我如何只更新元框而不保存数据库中的数据?这是我的代码:在Wordpress中保存自定义metabox的数据
// backwards compatible
add_action('admin_init', 'blc_add_custom_link_box', 1);
/* Do something with the data entered */
add_action('save_link', 'blc_save_linkdata');
/* Adds a box to the main column on the Post and Page edit screens */
function blc_add_custom_link_box() {
add_meta_box(
'backlinkdiv',
'Backlink URL',
'blc_backlink_url_input',
'link',
'normal',
'high'
);
}
/* Prints the box content */
function blc_backlink_url_input($post) {
// Use nonce for verification
wp_nonce_field(plugin_basename(__FILE__), 'blc_noncename');
// The actual fields for data entry
echo '<input type="text" id="backlink-url" name="backlink_url" value="put your backlink here" size="60" />';
#echo "<p> _e('Example: <code>http://Example.org/Linkpage</code> — don’t forget the <code>http://</code>')</p>";
}
如何保存或更新metabox输入字段的数据?只有数据应在metabox中更新。它不应该通过任何类型的自定义字段保存在数据库中。