Merge pull request #196 from jeherve/fix/fatal-api

Avoid Fatal Errors when Core REST API classes don't exist.
This commit is contained in:
Brian Miyaji
2017-02-17 23:19:23 +13:00
committed by GitHub
2 changed files with 12 additions and 8 deletions

View File

@@ -1,8 +1,10 @@
<?php
if ( class_exists( 'WP_REST_Posts_Controller' ) ) {
class SP_REST_Posts_Controller extends WP_REST_Posts_Controller {
public function __construct( $post_type ) {
parent::__construct( $post_type );
$this->namespace = 'sportspress/v2';
}
}
}

View File

@@ -1,8 +1,10 @@
<?php
if ( class_exists( 'WP_REST_Terms_Controller' ) ) {
class SP_REST_Terms_Controller extends WP_REST_Terms_Controller {
public function __construct( $taxonomy ) {
parent::__construct( $taxonomy );
$this->namespace = 'sportspress/v2';
}
}
}