WPSEO_Sitemaps_Admin::status_transition()publicYoast 1.0

Hooked into transition_post_status. Will initiate search engine pings if the post is being published, is a post type that a sitemap is built for and is a post that is included in sitemaps.

{} Это метод класса: WPSEO_Sitemaps_Admin{}

Хуков нет.

Возвращает

null. Ничего.

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

$WPSEO_Sitemaps_Admin = new WPSEO_Sitemaps_Admin();
$WPSEO_Sitemaps_Admin->status_transition( $new_status, $old_status, $post );
$new_status(строка) (обязательный)
New post status.
$old_status(строка) (обязательный)
Old post status.
$post(\WP_Post) (обязательный)
Post object.

Код WPSEO_Sitemaps_Admin::status_transition() Yoast 19.6.1

public function status_transition( $new_status, $old_status, $post ) {
	if ( $new_status !== 'publish' ) {
		return;
	}

	if ( defined( 'WP_IMPORTING' ) ) {
		$this->status_transition_bulk( $new_status, $old_status, $post );

		return;
	}

	$post_type = get_post_type( $post );

	wp_cache_delete( 'lastpostmodified:gmt:' . $post_type, 'timeinfo' ); // #17455.

	// Not something we're interested in.
	if ( $post_type === 'nav_menu_item' ) {
		return;
	}

	// If the post type is excluded in options, we can stop.
	if ( WPSEO_Options::get( 'noindex-' . $post_type, false ) ) {
		return;
	}

	if ( wp_get_environment_type() !== 'production' ) {
		return;
	}

	$this->ping_search_engines();
}