Yoast\WP\SEO\Routes
Yoast_Head_REST_Field::register_routes() public Yoast 1.0
Registers routes with WordPress.
{} Это метод класса: Yoast_Head_REST_Field{}
Хуков нет.
Возвращает
null.
Использование
$Yoast_Head_REST_Field = new Yoast_Head_REST_Field(); $Yoast_Head_REST_Field->register_routes();
Код Yoast_Head_REST_Field::register_routes() Yoast Head REST Field::register routes Yoast 15.7
public function register_routes() {
$public_post_types = $this->post_type_helper->get_public_post_types();
foreach ( $public_post_types as $post_type ) {
\register_rest_field( $post_type, self::YOAST_HEAD_FIELD_NAME, [ 'get_callback' => [ $this, 'for_post' ] ] );
}
$public_taxonomies = $this->taxonomy_helper->get_public_taxonomies();
foreach ( $public_taxonomies as $taxonomy ) {
if ( $taxonomy === 'post_tag' ) {
$taxonomy = 'tag';
}
\register_rest_field( $taxonomy, self::YOAST_HEAD_FIELD_NAME, [ 'get_callback' => [ $this, 'for_term' ] ] );
}
\register_rest_field( 'user', self::YOAST_HEAD_FIELD_NAME, [ 'get_callback' => [ $this, 'for_author' ] ] );
\register_rest_field( 'type', self::YOAST_HEAD_FIELD_NAME, [ 'get_callback' => [ $this, 'for_post_type_archive' ] ] );
}