WPSEO_Content_Images::get_post_content()privateYoast 1.0

Retrieves the post content we want to work with.

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

Хуки из метода

Возвращает

Строку. The content of the supplied post.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_post_content( $post_id, $post );
$post_id(int) (обязательный)
The post ID.
$post(WP_Post|массив|null) (обязательный)
The post.

Код WPSEO_Content_Images::get_post_content() Yoast 22.4

private function get_post_content( $post_id, $post ) {
	if ( $post === null ) {
		$post = get_post( $post_id );
	}

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

	/**
	 * Filter: 'wpseo_pre_analysis_post_content' - Allow filtering the content before analysis.
	 *
	 * @param string  $post_content The Post content string.
	 * @param WP_Post $post         The current post.
	 */
	$content = apply_filters( 'wpseo_pre_analysis_post_content', $post->post_content, $post );

	if ( ! is_string( $content ) ) {
		$content = '';
	}

	return $content;
}