Crash in WP admin due to robots_txt hooked function

[ad_1]

Hi there,

this problem is caused by the new feature – adding the sitemap to the robots.txt automatically:

500 error on all of /wp-admin/ if a plugin uses the robots_txt filter (in this case it was a different SEO plugin that the user had not deactivated – so in this case it would be tolerable, but just fix it for the future):

The first param is null in:
method_exists(seopress_pro_get_service(‘OptionPro’), ‘getRobotsTxtEnable’)
wp-seopress/inc/functions/options-robots-txt.php line 11

So you need to use !empty(…) or something like that in addition to method_exists, I guess – in the entire code base?

entire error message:
Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in …/wp-content/plugins/wp-seopress/inc/functions/options-robots-txt.php:11

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer