1

I get the following error when clicking on Customize Your Site after a clean install. It appears that $wp_customize is incorrectly null in the specified file? The entire install is successful, and I'm having a hard time finding documentation on the issue.

Fatal error: Uncaught Error: Call to a member function changeset_post_id() on null in /home/<user>/blog/wp-admin/customize.php:29 Stack trace: #0 {main} thrown in /home/<user>/blog/wp-admin/customize.php on line 29
8
  • Try re-uploading the files for the WP installation. – Dave Romsey Jan 18 '18 at 1:37
  • possibly a theme error also, if the $wp_customize global is not handled correctly there, maybe try reinstalling theme also – majick Jan 18 '18 at 2:33
  • @DaveRomsey it's the default WordPress theme. Even after a reinstall the problem is still present. I've even installed a custom theme, and the problem is still present after installation. – gopher Jan 18 '18 at 3:14
  • @majick see above :) – gopher Jan 18 '18 at 3:14
  • Are you using any plugins or mu-plugins? $wp_customize is set in _wp_customize_include() which is hooked to plugins_loaded. That function breaks early when $_SERVER['PHP_SELF'] doesn't equal to customize.php. Can you try accessing /wp-admin/customize.php?wp_customize=on? If that does work, it appears to be a server configuration issue. – swissspidy Jan 18 '18 at 11:23
1

It seems I got some faulty nginx configuration from an article on how to configure WordPress in a subdirectory.

Config Before

location @wp {
    rewrite ^/blog(.*) /blog/index.php?q=$1;
}

location ^~ /blog {
    root /home/user;
    index index.php index.html index.htm;
    try_files $uri $uri/ @wp;

    location ~ \.php$ {

        include fastcgi_params;

        fastcgi_index index.php;
        fastcgi_intercept_errors on;
        # Deleted this line
        fastcgi_split_path_info ^(/blog)(/.*)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }
    break;
}

Config After

location @wp {
    rewrite ^/blog(.*) /blog/index.php?q=$1;
}

location ^~ /blog {
    root /home/user;
    index index.php index.html index.htm;
    try_files $uri $uri/ @wp;

    location ~ \.php$ {

        include fastcgi_params;

        # Added this line
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_index index.php;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }
    break;
}

As mentioned in some comments, some PHP Server variables were incorrectly set due to a faulty nginx configuration causing issues when loading /wp-admin/customize.php

You can confirm your nginx configuration is faulty for this scenario if you visit /wp-admin/customize.php?wp_customize=on and it starts to work instead of throwing a fatal error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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