gpt4 book ai didi

wordpress - wordpress定制器中的菜单面板

转载 作者:行者123 更新时间:2023-12-03 08:12:48 26 4
gpt4 key购买 nike

我正在尝试使用以下代码删除 wordpress 定制器中的菜单面板,但它不起作用。请有人指导我。谢谢

$wp_customize->remove_panel( 'nav_menus' );

最佳答案

有 2 个 Trac 票证管理这个问题。完整的解决方案是

add_action( 'customize_register', function( $wp_customize ) {
/** @var WP_Customize_Manager $wp_customize */
remove_action( 'customize_controls_enqueue_scripts', array( $wp_customize->nav_menus, 'enqueue_scripts' ) );
remove_action( 'customize_register', array( $wp_customize->nav_menus, 'customize_register' ), 11 );
remove_filter( 'customize_dynamic_setting_args', array( $wp_customize->nav_menus, 'filter_dynamic_setting_args' ) );
remove_filter( 'customize_dynamic_setting_class', array( $wp_customize->nav_menus, 'filter_dynamic_setting_class' ) );
remove_action( 'customize_controls_print_footer_scripts', array( $wp_customize->nav_menus, 'print_templates' ) );
remove_action( 'customize_controls_print_footer_scripts', array( $wp_customize->nav_menus, 'available_items_template' ) );
remove_action( 'customize_preview_init', array( $wp_customize->nav_menus, 'customize_preview_init' ) );
}, 10 );

更多详情:

https://core.trac.wordpress.org/ticket/33552

https://core.trac.wordpress.org/ticket/33411

在旧版本的 wordpress (<4.3) 中这是有效的,但现在不行了:

function your_customizer( $wp_customize ) {
$wp_customize->remove_panel( 'widgets' );
}
add_action( 'customize_register', 'your_customizer' );

关于wordpress - wordpress定制器中的菜单面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32324815/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com