0

I know I am not supposed to alter Wordpress core. But if I want to use the dashboard user profile page at users-edit.php and remove big chunks of the code (like the color picker) how do I do it. From line 259 to 336 - I want to remove all of it.

<?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>
0

1 Answer 1

0

Found it - just added this action hook to the function file.

remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
1
  • Yes that's right, but you said, "From line 259 to 336 - I want to remove all of it.", so I thought you wanted to remove all those fields... anyway, glad you figured it out. :-)
    – Sally CJ
    Commented Jun 17, 2020 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.