Yoast\WP\SEO\Routes

Indexables_Page_Route::restore_all_indexables_for_list()publicYoast 1.0

Restores all indexables from a specific 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_all_indexables_for_list( $request );
$request(WP_REST_Request) (обязательный)
The request object.

Код Indexables_Page_Route::restore_all_indexables_for_list() Yoast 19.11

public function restore_all_indexables_for_list( WP_REST_Request $request ) {
	$params           = $request->get_json_params();
	$ignore_list_name = $params['type'] . '_ignore_list';

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

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