Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript wordpress中的屏幕选项不适用于新的自定义元框_Javascript_Php_Jquery_Html_Wordpress - Fatal编程技术网

Javascript wordpress中的屏幕选项不适用于新的自定义元框

Javascript wordpress中的屏幕选项不适用于新的自定义元框,javascript,php,jquery,html,wordpress,Javascript,Php,Jquery,Html,Wordpress,我已经创建了一个名为“我的自定义设置”的元框,它位于wordpress的post下,带有一个输入文本框字段。在上面的文章页面中,我看到了屏幕选项菜单中预定义的“在屏幕上显示”。在添加新的“我的自定义设置”元框后,它也可以在该屏幕选项中使用 我刚刚隐藏了“我的自定义设置”。但它似乎仍在发布中 为什么在屏幕上隐藏选项时不隐藏 我的密码是 <?php add_action( 'add_meta_boxes', 'meta_add_custom_box' ); add_action( 'save_

我已经创建了一个名为“我的自定义设置”的元框,它位于wordpress的post下,带有一个输入文本框字段。在上面的文章页面中,我看到了屏幕选项菜单中预定义的“在屏幕上显示”。在添加新的“我的自定义设置”元框后,它也可以在该屏幕选项中使用

我刚刚隐藏了“我的自定义设置”。但它似乎仍在发布中

为什么在屏幕上隐藏选项时不隐藏

我的密码是

<?php
add_action( 'add_meta_boxes', 'meta_add_custom_box' );
add_action( 'save_post', 'meta_save_custom_meta_box' );
function meta_add_custom_box( $post ) {
add_meta_box(
'Meta Box', // ID, should be a string
'My Custom Settings', // Meta Box Title
'meta_custom_meta_box_content', // Your call back function, this is where your form field will go
'post', // The post type you want this to show up on, can be post, page, or custom post type
'normal', // The placement of your meta box, can be normal or side
'high' // The priority in which this will be displayed
);
}

function meta_save_custom_meta_box(){
global $post;
// Get our form field
if( $_POST ) :
$meta_custom_meta = esc_attr( $_POST['meta-custom-meta-box'] );
// Update post meta
update_post_meta($post->ID, '_meta_custom_meta', $meta_custom_meta);
endif;
}

function meta_custom_meta_box_content( $post ) {
$meta_custom_meta = get_post_meta($post->ID, '_meta_custom_meta', true);
//meta title with character counting
echo '<p><label>Custom Title:</label></p>';
echo '<p><input style="width:99%;" class="meta-text" type="text" name="meta-custom-meta-box" value="'.$meta_custom_meta.'" /></p>';
}
?>

是否需要为要隐藏的屏幕选项添加额外代码
如果是,请更新我的代码。

试试这个

 add_filter('default_hidden_meta_boxes', 'hide_meta_lock', 10, 2);
 function hide_meta_lock($hidden, $screen) {
if ( 'frog' == $screen->base )
    $hidden = array('postexcerpt','Meta Box');
    // removed 'postexcerpt',
return $hidden;
 }