Avoid Fatal Errors when Core REST API classes don't exist.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
class SP_REST_Posts_Controller extends WP_REST_Posts_Controller {
|
||||
public function __construct( $post_type ) {
|
||||
parent::__construct( $post_type );
|
||||
$this->namespace = 'sportspress/v2';
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
class SP_REST_Terms_Controller extends WP_REST_Terms_Controller {
|
||||
public function __construct( $taxonomy ) {
|
||||
parent::__construct( $taxonomy );
|
||||
$this->namespace = 'sportspress/v2';
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user