简体   繁体   English

在WordPress Customizer上禁用WordPress Custom CSS部分

[英]Disable WordPress Custom css section on WordPress Customizer

Anyone can help me to locking/ disabling the Appearance -> Customizer -> Additional CSS area. 任何人都可以帮助我锁定/禁用外观->定制程序->其他CSS区域。 on Wp-admin. 在Wp-admin上。

截图

I read this codex https://codex.wordpress.org/Theme_Customization_API But didn't got any hook or function for disabling it. 我读过此编解码器https://codex.wordpress.org/Theme_Customization_API,但是没有禁用它的任何钩子或函数。 Actually, I don't need this, anyone developer's adding unnecessary CSS from here and this saving on the database. 实际上,我不需要此功能,任何开发人员都可以从此处添加不必要的CSS,并将此保存在数据库中。 Please suggest any solution, If that is possible to do. 请提出任何解决方案,如果可能的话。

Thank you in advance for your valuable reply. 预先感谢您的宝贵答复。

You could try removing the section using the WP Customizer function hook: 您可以尝试使用WP Customizer函数挂钩删除该部分:

function mytheme_customize_register( $wp_customize )
{
   $wp_customize->remove_section('custom_css');
}
add_action( 'customize_register', 'mytheme_customize_register' );

Obviously you can name the function to suit, but call this block in your theme's functions.php file and it should remove this admin section (it most likely has an ID of 'custom_css' but could potentially vary) 显然,您可以命名该函数以适合您,但是可以在主题的functions.php文件中调用此块,并且应该删除此管理部分(它最有可能具有“ custom_css”的ID,但可能会有所不同)

Source: https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/remove_section#Parameters 来源: https : //codex.wordpress.org/Class_Reference/WP_Customize_Manager/remove_section#Parameters

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM