Skip to content

Commit ef8a3a6

Browse files
authored
Fix activation fatal error
Moving the require_once inside the init function fixes the "Fatal error: Class 'WP_REST_Controller' not found" on activation.
1 parent 62a03f2 commit ef8a3a6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

plugin.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313
/**
1414
* WP_REST_Multiple_PostType_Controller class.
1515
*/
16-
if (!class_exists('WP_REST_Multiple_PostType_Controller')) {
17-
18-
require_once dirname(__FILE__) . '/lib/endpoints/class-wp-rest-multiple-posttype-controller.php';
19-
}
2016

2117
function init_wp_rest_multiple_posttype_endpoint() {
18+
if (!class_exists('WP_REST_Multiple_PostType_Controller')) {
19+
require_once dirname(__FILE__) . '/lib/endpoints/class-wp-rest-multiple-posttype-controller.php';
20+
}
2221
$controller = new WP_REST_Multiple_PostType_Controller();
2322
$controller->register_routes();
2423
}

0 commit comments

Comments
 (0)