WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта
функция не описана


Force_Rewrite_Title::flush_cache() public Yoast 1.0

Used in the force rewrite functionality this retrieves the output, replaces the title with the proper SEO title and then flushes the output.

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

Хуков нет.




$Force_Rewrite_Title = new Force_Rewrite_Title();

Код Force_Rewrite_Title::flush_cache() Yoast 16.8

public function flush_cache() {
	if ( $this->ob_started !== true ) {
		return false;

	$content = $this->get_buffered_output();

	$old_wp_query = $this->wp_query->get_query();


	// When the file has the debug mark.
	if ( \preg_match( '/(?\'before\'.*)<!-- This site is optimized with the Yoast SEO.*<!-- \/ Yoast SEO( Premium)? plugin. -->(?\'after\'.*)/is', $content, $matches ) ) {
		$content = $this->replace_titles_from_content( $content, $matches );

		unset( $matches );

	// phpcs:ignore WordPress.WP.GlobalVariablesOverride -- The query gets reset here with the original query.
	$GLOBALS['wp_query'] = $old_wp_query;

	// phpcs:ignore WordPress.Security.EscapeOutput -- The output should already have been escaped, we are only filtering it.
	echo $content;

	return true;