• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WP_Taxonomy::get_rest_controller() – Gets the REST API controller for this taxonomy.

You appear to be a bot. Output may be restricted

Description

Gets the REST API controller for this taxonomy.

Will only instantiate the controller class once per request.

Usage

$WP_REST_Controller|null = WP_Taxonomy::get_rest_controller();

Parameters

Returns

WP_REST_Controller|null The controller instance, or null if the taxonomy is set not to show in rest.

Source

File name: wordpress/wp-includes/class-wp-taxonomy.php
Lines:

1 to 25 of 25
  public function get_rest_controller() {
    if ( ! $this->show_in_rest ) {
      return null;
    }

    $class = $this->rest_controller_class ? $this->rest_controller_class : WP_REST_Terms_Controller::class;

    if ( ! class_exists( $class ) ) {
      return null;
    }

    if ( ! is_subclass_of( $class, WP_REST_Controller::class ) ) {
      return null;
    }

    if ( ! $this->rest_controller ) {
      $this->rest_controller = new $class( $this->name );
    }

    if ( ! ( $this->rest_controller instanceof $class ) ) {
      return null;
    }

    return $this->rest_controller;
  }
 

 View on GitHub View on Trac

Published: 21st August 2020 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: WP_Taxonomy::get_rest_controller
Class ref: WP_Taxonomy
Plugin ref: WordPress
Version: 5.6.2
Sourcefile: wp-includes/class-wp-taxonomy.php
File ref: wp-includes/class-wp-taxonomy.php
Deprecated?: No
API Letters: C,G,R,T,W

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6.2
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites