如何从USERS-edit.php中删除颜色选择器代码

时间:2020-06-16 作者:Doug Higson

我知道我不应该改变Wordpress的核心。但如果我想在“用户编辑”中使用仪表板用户配置文件页面。php和删除大块代码(如颜色选择器)的方法。从第259行到第336行-我想全部删除。

<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
    <tr class="user-rich-editing-wrap">
        <th scope="row"><?php _e( \'Visual Editor\' ); ?></th>
        <td>
            <label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked( \'false\', $profileuser->rich_editing ); ?> />
                <?php _e( \'Disable the visual editor when writing\' ); ?>
            </label>
        </td>
    </tr>
        <?php endif; ?>
        <?php
        $show_syntax_highlighting_preference = (
        // For Custom HTML widget and Additional CSS in Customizer.
        user_can( $profileuser, \'edit_theme_options\' )
        ||
        // Edit plugins.
        user_can( $profileuser, \'edit_plugins\' )
        ||
        // Edit themes.
        user_can( $profileuser, \'edit_themes\' )
        );
        ?>

        <?php if ( $show_syntax_highlighting_preference ) : ?>
    <tr class="user-syntax-highlighting-wrap">
        <th scope="row"><?php _e( \'Syntax Highlighting\' ); ?></th>
        <td>
            <label for="syntax_highlighting"><input name="syntax_highlighting" type="checkbox" id="syntax_highlighting" value="false" <?php checked( \'false\', $profileuser->syntax_highlighting ); ?> />
                <?php _e( \'Disable syntax highlighting when editing code\' ); ?>
            </label>
        </td>
    </tr>
        <?php endif; ?>

        <?php if ( count( $_wp_admin_css_colors ) > 1 && has_action( \'admin_color_scheme_picker\' ) ) : ?>
    <tr class="user-admin-color-wrap">
        <th scope="row"><?php _e( \'Admin Color Scheme\' ); ?></th>
        <td>
            <?php
            /**
             * Fires in the \'Admin Color Scheme\' section of the user editing screen.
             *
             * The section is only enabled if a callback is hooked to the action,
             * and if there is more than one defined color scheme for the admin.
             *
             * @since 3.0.0
             * @since 3.8.1 Added `$user_id` parameter.
             *
             * @param int $user_id The user ID.
             */
            do_action( \'admin_color_scheme_picker\', $user_id );
            ?>
        </td>
    </tr>
        <?php endif; // End if count ( $_wp_admin_css_colors ) > 1 ?>

        <?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
    <tr class="user-comment-shortcuts-wrap">
        <th scope="row"><?php _e( \'Keyboard Shortcuts\' ); ?></th>
        <td>
            <label for="comment_shortcuts">
                <input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked( \'true\', $profileuser->comment_shortcuts ); ?> />
                <?php _e( \'Enable keyboard shortcuts for comment moderation.\' ); ?>
            </label>
            <?php _e( \'<a href="https://wordpress.org/support/article/keyboard-shortcuts/" target="_blank">More information</a>\' ); ?>
        </td>
    </tr>
        <?php endif; ?>

    <tr class="show-admin-bar user-admin-bar-front-wrap">
        <th scope="row"><?php _e( \'Toolbar\' ); ?></th>
        <td>
            <label for="admin_bar_front">
                <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( \'front\', $profileuser->ID ) ); ?> />
                <?php _e( \'Show Toolbar when viewing site\' ); ?>
            </label><br />
        </td>
    </tr>

1 个回复
最合适的回答,由SO网友:Doug Higson 整理而成

找到了-刚刚将此操作挂钩添加到函数文件中。

remove_action( \'admin_color_scheme_picker\', \'admin_color_scheme_picker\' );