John Davidson

php - Remove color scheme options from user's profile page in WordPress 6.0

0 comments
Message:


I've always used this code in a must-use plugin to remove the whole color schemes section:


remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

Unfortunately, with WordPress 6.0 this does not work anymore. I've found that Core's add_action( 'admin_color_... was recently moved from default-filters.php file to the admin-filters.php file, but I am unsure why and how I'd have to update the above snippet to make it work again.



My Answer:
To remove the color scheme options from the user's profile page in WordPress 6.0, you can use the following code:

php
add_action( 'admin_init', 'remove_color_scheme_options' );
function remove_color_scheme_options() {
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
}


This code hooks into the `admin_init` action and removes the `admin_color_scheme_picker` function, effectively removing the color scheme options from the user's profile page.

Make sure to add this code to your theme's functions.php file or a custom plugin. This should work in WordPress 6.0 and remove the color scheme options as desired.

Rate this post

3 of 5 based on 9839 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us