I have a client's website that is showing up white when their theme is installed. It is a completely custom theme that someone else created.

Client says he reverted to a backup of the site and it came back, he thinks it is WordPress's auto update that broke the site. Said the hosting company turned off auto updates but it is white screen of death again today.

Website: https://www.staging8.lakeshoresup.com/

Hosting company referfed him to this error:

PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'theme_prefix_setup' not found or invalid function name in /wp-includes/class-wp-hook.php on line 324.

I have no idea where to event look for this. I searched for a reference to the function in the class-wp-hook.php file and in the functions.php in the custom theme but there is nothing.

I have disabled all the plugins and it still doesn't work.

When I switch to a default WP theme the site does come up but of course doesn't work because the theme is highly customized.


Thanks to Jacob Peattie I found the file with the function in question using a search function in Notepad ++. It is in a file called setup.php un my_theme\src\setup.php

I don't see anything related to call_user_func_array(). I did find the add_action () with theme_prefix_setup as the second parameter.

Here's the code for the function...

 * Theme Logo

function theme_prefix_setup() {
  add_theme_support( 'custom-logo' );
add_action( 'after_setup_theme', 'theme_prefix_setup' );

add_theme_support( 'custom-logo', array(
   'height'      => 175,
   'width'       => 400,
   'flex-width'  => true,
   'flex-height' => true
) );

add_image_size( 'x_large', '1280', '0', false );

As you can see the theme_prefix_setup() does exist calls for custom-logo. custom-logo is not an any other theme files other than the two mentions above.

I thought it may be just the order of things. Maybe we needed to do the add_theme_support( 'custom-logo', array( call earlier so I tried moving everything after add_action( 'after_setup_theme', 'theme_prefix_setup' ); above that function name and got no results.

Note that the site works find with WordPress 6.4.1. It only breaks with 6.4.2

Can anyone give us an idea of what is causing it?

  • 1
    Somewhere in the theme add_action() is being called with 'theme_prefix_setup' as the 2nd parameter, but a theme_prefix_setup() function does not exist. That could be in functions.php, or it could be in another PHP file that's included into functions.php with include or require. If there are other PHP files, you should check those. When you find it, remove the add_action() line. Dec 19, 2023 at 1:01
  • 1
    So should I just be searching through any php file in the theme for 'theme_prefix_setup'? Would that be the easiest way to find the issue? Dec 19, 2023 at 2:52
  • 1
    @InventiveWebDesign That's how I'd start, for sure. Something like find theme-name -name "*.php* -exec grep -iHn theme_prefix_setup {} \; might help, if you're comfortable with the command line on Linux or Mac. (Assuming you're in the site's wp-content/themes directory, and the theme is called theme-name.)
    – Pat J
    Dec 19, 2023 at 4:11
  • Thanks, I used Notepad ++ to search on my windows pc and found the file in question. I added it to the post above. Any ideas on how to fix the issue now would be greatly appreciated. It seems so simple that there should be no error but I am not a wordpress developer and don't know all the tricks :) Dec 19, 2023 at 18:20


Your Answer

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

Browse other questions tagged or ask your own question.