Yoast\WP\SEO\Actions

Indexables_Page_Action::get_most_linked()publicYoast 1.0

Устарела с версии 20.4. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Gets the most linked posts.

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

Хуков нет.

Возвращает

Массив. The most linked posts as an array.

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

$Indexables_Page_Action = new Indexables_Page_Action();
$Indexables_Page_Action->get_most_linked( $limit );
$limit(int) (обязательный)
The maximum amount of results to return.

Список изменений

Устарела с 20.4

Код Indexables_Page_Action::get_most_linked() Yoast 22.4

public function get_most_linked( $limit ) {
	\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );

	// Where_not_equal needs the set to check against not to be empty.
	$most_linked_ignore_list = $this->options_helper->get( 'most_linked_ignore_list', [] );
	$ignore_list             = empty( $most_linked_ignore_list ) ? [ -1 ] : $most_linked_ignore_list;

	$most_linked = $this->query()
		->select_many( 'id', 'object_id', 'object_sub_type', 'permalink', 'breadcrumb_title', 'incoming_link_count', 'is_cornerstone' )
		->where_gt( 'incoming_link_count', 0 )
		->where_not_null( 'incoming_link_count' )
		->where_not_in( 'id', $ignore_list )
		->order_by_desc( 'incoming_link_count' )
		->limit( $limit )
		->find_many();

	return \array_map( [ $this->indexable_repository, 'ensure_permalink' ], $most_linked );
}