Skip to content

Commit 297fabf

Browse files
committed
Only init the routes one time (not once per object)
1 parent 35e1e72 commit 297fabf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

includes/CMB2_REST.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function __construct( CMB2 $cmb ) {
102102
*/
103103
public function universal_hooks() {
104104
// hook up the CMB rest endpoint classes
105-
$this->once( 'rest_api_init', array( $this, 'init_routes' ), 0 );
105+
$this->once( 'rest_api_init', array( __CLASS__, 'init_routes' ), 0 );
106106

107107
if ( function_exists( 'register_rest_field' ) ) {
108108
$this->once( 'rest_api_init', array( __CLASS__, 'register_cmb2_fields' ), 50 );
@@ -120,7 +120,7 @@ public function universal_hooks() {
120120
*
121121
* @return void
122122
*/
123-
public function init_routes() {
123+
public static function init_routes() {
124124
$wp_rest_server = rest_get_server();
125125

126126
$boxes_controller = new CMB2_REST_Controller_Boxes( $wp_rest_server );

0 commit comments

Comments
 (0)