Yoast\WP\SEO\Actions

Indexables_Page_Action::remove_indexable_from_ignore_list()publicYoast 1.0

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

Removes an indexable from its ignore-list.

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

Хуков нет.

Возвращает

true|false. Whether saving the ignore-list to the database succeeded.

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

$Indexables_Page_Action = new Indexables_Page_Action();
$Indexables_Page_Action->remove_indexable_from_ignore_list( $ignore_list_name, $indexable_id );
$ignore_list_name(строка) (обязательный)
The name of the ignore-list.
$indexable_id(int) (обязательный)
The ID of the indexable to store in the ignore-list.

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

Устарела с 20.4

Код Indexables_Page_Action::remove_indexable_from_ignore_list() Yoast 21.6

public function remove_indexable_from_ignore_list( $ignore_list_name, $indexable_id ) {
	\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );

	if ( ! $this->indexables_page_helper->is_valid_ignore_list_name( $ignore_list_name ) ) {
		return false;
	}

	$ignore_list = $this->options_helper->get( $ignore_list_name, [] );

	$ignore_list = \array_values(
		\array_filter(
			$ignore_list,
			static function( $indexable ) use ( $indexable_id ) {
				return $indexable !== $indexable_id;
			}
		)
	);

	return $this->options_helper->set( $ignore_list_name, $ignore_list );
}