WordPress semicolon error in functions.php

Jul 19, 2020
33
12
8
Hello Mates,
When I'm adding custom code to functions.php file, it is throwing error. here is the code below
PHP:
add_action( 'admin_head-profile.php', 'wpse_72463738_remove_admin_color_scheme_picker' );

wpse_72463738_remove_admin_color_scheme_picker() {
    remove_action( 'admin_color_scheme_picker','admin_color_scheme_picker' );
}

Error:

Markdown (GitHub flavored):
Your PHP code changes were rolled back due to an error on line 70 of file wp-content/themes/twentytwentytwo/functions.php. Please fix and try saving again.
syntax error, unexpected token ";"
Please Help me to solve this error
 

frizzel

Well-known member
Trusted Uploader
Jun 13, 2019
485
253
63
Wherever my imagination takes me
The 'wpse' thing is a function and needs to be called that way. So, the correct code is:

PHP:
function wpse_72463738_remove_admin_color_scheme_picker() {
    remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
}

add_action( 'admin_head-profile.php', 'wpse_72463738_remove_admin_color_scheme_picker' );
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu