Yoast\WP\SEO\Routes

Indexables_Page_Route::restore_indexable()publicYoast 1.0

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

Restores an indexable id from the ignore list.

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

Хуков нет.

Возвращает

WP_REST_Response|WP_Error. The success or failure response.

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

$Indexables_Page_Route = new Indexables_Page_Route();
$Indexables_Page_Route->restore_indexable( $request );
$request(WP_REST_Request) (обязательный)
The request object.

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

Устарела с 20.4

Код Indexables_Page_Route::restore_indexable() Yoast 22.4

public function restore_indexable( WP_REST_Request $request ) {
	\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );

	$params           = $request->get_json_params();
	$ignore_list_name = $params['type'] . '_ignore_list';
	$indexable_id     = \intval( $params['id'] );

	if ( $this->indexables_page_action->remove_indexable_from_ignore_list( $ignore_list_name, $indexable_id ) ) {
		return new WP_REST_Response(
			[
				'json' => (object) [ 'success' => true ],
			],
			200
		);
	}

	return new WP_Error(
		'restore_failed',
		'Could not save the option in the database',
		[
			'status' => 500,
		]
	);
}