Yoast\WP\SEO\Routes

Workouts_Route::register_routes()publicYoast 1.0

Registers routes with WordPress.

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

Хуков нет.

Возвращает

null. Ничего.

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

$Workouts_Route = new Workouts_Route();
$Workouts_Route->register_routes();

Код Workouts_Route::register_routes() Yoast 19.11

public function register_routes() {
	$edit_others_posts = static function() {
		return \current_user_can( 'edit_others_posts' );
	};

	$workouts_route = [
		[
			'methods'             => 'GET',
			'callback'            => [ $this, 'get_workouts' ],
			'permission_callback' => $edit_others_posts,
		],
		[
			'methods'             => 'POST',
			'callback'            => [ $this, 'set_workouts' ],
			'permission_callback' => $edit_others_posts,
			'args'                => $this->get_workouts_routes_args(),
		],
	];

	\register_rest_route( Main::API_V1_NAMESPACE, self::WORKOUTS_ROUTE, $workouts_route );
}