Yoast\WP\SEO\Helpers

Image_Helper::get_post_content_image()publicYoast 1.0

Gets the image url from the content.

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

Хуков нет.

Возвращает

Строку. The image url or an empty string when not found.

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

$Image_Helper = new Image_Helper();
$Image_Helper->get_post_content_image( $post_id );
$post_id(int) (обязательный)
The post id to extract the images from.

Код Image_Helper::get_post_content_image() Yoast 22.4

public function get_post_content_image( $post_id ) {
	$image_url = $this->get_first_usable_content_image_for_post( $post_id );

	if ( $image_url === null ) {
		return '';
	}

	return $image_url;
}