Wordpress-seo: robots-helper.php:27 Issue

Created on 28 Apr 2020  路  8Comments  路  Source: Yoast/wordpress-seo

  • [x] I've read and understood the contribution guidelines.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

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

Please describe what you expected to happen and why.

No errors or warning should happen.

How can we reproduce this behavior?

  1. Upgrade to 14.x
  2. Check for warnings and errors
    3.

Technical info


* If relevant, which editor is affected (or editors):
- [ ] Classic Editor
- [ ] Gutenberg
- [ ] Classic Editor plugin


* Which browser is affected (or browsers):
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Other

Used versions

  • WordPress version: 5.4
  • Yoast SEO version: 14.0.1
  • Gutenberg plugin version:
  • Classic Editor plugin version:
  • Relevant plugins in case of a bug:
  • Tested with theme:
0.5 innovation

Most helpful comment

Fixed in #14973.

All 8 comments

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

Used versions

  • WordPress version: 5.4
  • Yoast SEO version: 14.0.1

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.

Was this page helpful?
0 / 5 - 0 ratings