Yoast\WP\SEO\Routes

Indexables_Page_Route::restore_indexable()publicYoast 1.0

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.

Код Indexables_Page_Route::restore_indexable() Yoast 19.10

public function restore_indexable( WP_REST_Request $request ) {
	$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,
		]
	);
}