Yoast\WP\SEO\Alerts\User_Interface\Default_SEO_Data

Default_SEO_Data_Cron_Callback_Integration::detect_default_seo_data_in_recent │ public │ Yoast 1.0

Detects default SEO data in recent posts and updates the relevant options.

Метод класса: Default_SEO_Data_Cron_Callback_Integration{}

Хуков нет.

Возвращает

void. Ничего (null).

Использование

$Default_SEO_Data_Cron_Callback_Integration = new Default_SEO_Data_Cron_Callback_Integration();
$Default_SEO_Data_Cron_Callback_Integration->detect_default_seo_data_in_recent(): void;

Код Default_SEO_Data_Cron_Callback_Integration::detect_default_seo_data_in_recent() Yoast 28.9

public function detect_default_seo_data_in_recent(): void {
	if ( ! \wp_doing_cron() ) {
		return;
	}

	$recent_posts = $this->indexable_repository->get_recently_modified_posts( 'post', 5, false );

	$recent_default_seo_title     = [];
	$recent_default_seo_meta_desc = [];
	foreach ( $recent_posts as $post ) {
		if ( $post->title === null ) {
			$recent_default_seo_title[] = $post->object_id;
		}

		if ( $post->description === null ) {
			$recent_default_seo_meta_desc[] = $post->object_id;
		}
	}

	$this->options_helper->set( 'default_seo_title', $recent_default_seo_title );
	$this->options_helper->set( 'default_seo_meta_desc', $recent_default_seo_meta_desc );
}