3

任何人都可以帮助我锁定/禁用外观 -> 定制器 -> 附加 CSS 区域。在 Wp 管理员上。

截屏

我读了这个法典https://codex.wordpress.org/Theme_Customization_API 但没有任何钩子或功能来禁用它。实际上,我不需要这个,任何开发人员从这里添加不必要的 CSS 并节省数据库。请提出任何解决方案,如果可以的话。

预先感谢您的宝贵回复。

4

1 回答 1

4

您可以尝试使用 WP Customizer 函数挂钩删除该部分:

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

显然你可以命名函数以适应,但在你的主题的functions.php文件中调用这个块,它应该删除这个管理部分(它很可能有一个'custom_css'的ID,但可能会有所不同)

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

于 2018-01-01T19:00:15.230 回答