我正在尝试删除在 Wordpress 站点中更改“站点图标”的功能,除非用户是“超级管理员”。
我的第一个想法是尝试修改位于 **/wp-includes/class-wp-customize-manager.php 中的这段代码片段
$this->add_setting( 'site_icon', array(
'type' => 'option',
'capability' => 'manage_options',
'transport' => 'postMessage', // Previewed with JS in the Customizer controls window.
) );
$this->add_control( new WP_Customize_Site_Icon_Control( $this, 'site_icon', array(
'label' => __( 'Site Icon' ),
'description' => sprintf(
/* translators: %s: site icon size in pixels */
__( 'The Site Icon is used as a browser and app icon for your site. Icons must be square, and at least %s pixels wide and tall.' …Run Code Online (Sandbox Code Playgroud)