diff --git a/bp-rest.php b/bp-rest.php index d511c0f7..6081d777 100644 --- a/bp-rest.php +++ b/bp-rest.php @@ -86,7 +86,7 @@ function bp_rest() { $controller->register_routes(); } - if ( bp_is_active( 'blogs' ) ) { + if ( is_multisite() && bp_is_active( 'blogs' ) ) { require_once dirname( __FILE__ ) . '/includes/bp-blogs/classes/class-bp-rest-blogs-endpoint.php'; $controller = new BP_REST_Blogs_Endpoint(); $controller->register_routes(); diff --git a/includes/bp-activity/classes/class-bp-rest-activity-endpoint.php b/includes/bp-activity/classes/class-bp-rest-activity-endpoint.php index ac29287b..e879b1e0 100644 --- a/includes/bp-activity/classes/class-bp-rest-activity-endpoint.php +++ b/includes/bp-activity/classes/class-bp-rest-activity-endpoint.php @@ -1149,7 +1149,7 @@ protected function prepare_links( $activity ) { } // Embed Blog. - if ( bp_is_active( 'blogs' ) && buddypress()->blogs->id === $activity->component && ! empty( $activity->item_id ) ) { + if ( is_multisite() && bp_is_active( 'blogs' ) && buddypress()->blogs->id === $activity->component && ! empty( $activity->item_id ) ) { $links['blog'] = array( 'embeddable' => true, 'href' => rest_url( diff --git a/includes/bp-notifications/classes/class-bp-rest-notifications-endpoint.php b/includes/bp-notifications/classes/class-bp-rest-notifications-endpoint.php index e7cfd6e9..460e0b17 100644 --- a/includes/bp-notifications/classes/class-bp-rest-notifications-endpoint.php +++ b/includes/bp-notifications/classes/class-bp-rest-notifications-endpoint.php @@ -692,7 +692,7 @@ protected function prepare_links( $notification ) { } // Embed Blog. - if ( bp_is_active( 'blogs' ) && buddypress()->blogs->id === $notification->component_name && ! empty( $notification->item_id ) ) { + if ( is_multisite() && bp_is_active( 'blogs' ) && buddypress()->blogs->id === $notification->component_name && ! empty( $notification->item_id ) ) { $links['blog'] = array( 'embeddable' => true, 'href' => rest_url( diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4dd25eca..cea340d1 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,6 +9,8 @@ ./tests/testcases/ + tests/testcases/blogs/test-controller.php + tests/testcases/attachments/test-blog-avatar-controller.php