YOAST SEO – Die Optimierung der SEO-Daten ist für nicht-produktive Umgebungen deaktiviert

PROBLEM

Error message in WP backend, YOAST SEO Plugin, Running first time configuration:

SEO data optimization is disabled for non-production environments

Die Optimierung der SEO-Daten ist für nicht-produktive Umgebungen deaktiviert

CAUSE

On sites that are not live, several things are not necessary. 

Thus, in these cases, the YOAST SEO plugin [...] disables data tracking and disables search engine pinging about the XML sitemap.

https://developer.yoast.com/customization/yoast-seo/wp-get-environment-type-in-yoast-seo/

SOLUTION

Change settings in wp-config.php
define( 'WP_ENVIRONMENT_TYPE', 'production' );

WORKAROUND

Create a mu-plugin for YOAST SEO:

<?php
// wp-content/mu-plugins/yoast-custom.php
add_filter( 'Yoast\WP\SEO\should_index_indexables', '__return_true' );
?>

https://wordpress.org/support/topic/why-is-reindex-disabled-in-non-production/

CONTEXT

WP_ENVIRONMENT_TYPE

production – this is the default. A site that is running live, connected to the internet and reachable on the internet.
staging – this is what you would use for staging environments, probably both connected to and reachable on the internet.
development – this is what you would use for development environments that are reachable on the internet, we automatically enable WP_DEBUG on environments where this is the environment type.
local – added in 5.5.1, this (usually development) environment can reach the internet but is not be reachable from the internet.

By limiting the set of environment types in this way, WordPress core, plugins, and themes can change their behavior depending on this setting.

https://make.wordpress.org/core/2020/08/27/wordpress-environment-types/