Yoast\WP\SEO\Context

Meta_Tags_Context::get_main_image_url_for_rest_request()privateYoast 1.0

Gets the main image URL for REST requests.

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

Хуков нет.

Возвращает

Строку|null. The main image URL.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_main_image_url_for_rest_request();

Код Meta_Tags_Context::get_main_image_url_for_rest_request() Yoast 24.3

private function get_main_image_url_for_rest_request() {
	switch ( $this->page_type ) {
		case 'Post_Type':
			if ( $this->post instanceof WP_Post ) {
				$url = $this->image->get_post_content_image( $this->post->ID );
				if ( $url === '' ) {
					return null;
				}
				return $url;
			}
			return null;
		default:
			return null;
	}
}