WP_REST_Taxonomies_Controller example



    // Post types.     $controller = new WP_REST_Post_Types_Controller();
    $controller->register_routes();

    // Post statuses.     $controller = new WP_REST_Post_Statuses_Controller();
    $controller->register_routes();

    // Taxonomies.     $controller = new WP_REST_Taxonomies_Controller();
    $controller->register_routes();

    // Terms.     foreach ( get_taxonomies( array( 'show_in_rest' => true ), 'object' ) as $taxonomy ) {
        $controller = $taxonomy->get_rest_controller();

        if ( ! $controller ) {
            continue;
        }

        $controller->register_routes();
    }
Home | Imprint | This part of the site doesn't use cookies.