小编ran*_*han的帖子

在 Wordpress 中保存自定义元数据框的数据

我在编辑链接页面中添加了一个元框,无论我在该字段中放入什么,我都无法保存数据。如何只更新元框而不将数据保存在数据库中?这是我的代码:

// 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 …
Run Code Online (Sandbox Code Playgroud)

wordpress

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

wordpress ×1