Since upgrading to 14.x the following warning is shown:
in_array() expects parameter 2 to be array, null given
wp-content/plugins/wordpress-seo/src/helpers/robots-helper.php:27
Yoast\W\S\H\Robots_Helper->set_robots_no_index()
wp-includes/class-wp-hook.php:287
After that:
Undefined property: Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$robots
No errors or warning should happen.
* If relevant, which editor is affected (or editors):
- [ ] Classic Editor
- [ ] Gutenberg
- [ ] Classic Editor plugin
* Which browser is affected (or browsers):
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Other
More warnings and notices in the same file for me after updating to v. 14.0.1.
Notice: Undefined property: Yoast\WP\SEO\Presentations\Indexable_Static_Home_Page_Presentation::$robots in ../wp-content/plugins/wordpress-seo/src/helpers/robots-helper.php on line 27
Warning: in_array() expects parameter 2 to be array, null given in ../wp-content/plugins/wordpress-seo/src/helpers/robots-helper.php on line 27
Notice: Undefined property: Yoast\WP\SEO\Presentations\Indexable_Static_Home_Page_Presentation::$robots in ../wp-content/plugins/wordpress-seo/src/helpers/robots-helper.php on line 31
For what it's worth I can see the following notices and warnings on a standard WP route: /wp-json/wp/v2/posts
Notice: Undefined property: Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$robots in /var/www/html/wp-content/plugins/wordpress-seo/src/helpers/robots-helper.php on line 31
Notice: Undefined property: Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$robots in /var/www/html/wp-content/plugins/wordpress-seo/src/helpers/robots-helper.php on line 27
Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/wp-content/plugins/wordpress-seo/src/helpers/robots-helper.php on line 27
Used versions
WordPress version: 5.4
Yoast SEO version: 14.0.1
Please inform the customer of conversation # 606197 when this conversation has been closed.
This issue happens when you disallow serachengines from indexing your site.
This error is killing my headless WP site build. Had to disable just to return the page!!
This happens when you have the reading setting Search Engine Visibility on discourage.
@igorschoester yep problem is I need to discourage that Wordpress instance as it is just an API the site doesn鈥檛 live there.
Fixed in #14973.
Most helpful comment
Fixed in #14973.