diff --git a/classes/controllers/FrmHooksController.php b/classes/controllers/FrmHooksController.php index f193723f05..a87b5e328d 100644 --- a/classes/controllers/FrmHooksController.php +++ b/classes/controllers/FrmHooksController.php @@ -59,8 +59,10 @@ public static function trigger_load_form_hooks() { * @return void */ public static function load_hooks() { + // Use 0 so this gets triggered before FrmFormActionsController::register_post_types. + add_action( 'init', 'FrmAppController::load_lang', 0 ); + add_action( 'rest_api_init', 'FrmAppController::create_rest_routes', 0 ); - add_action( 'plugins_loaded', 'FrmAppController::load_lang' ); add_filter( 'widget_text', 'do_shortcode' ); // Entries controller. diff --git a/tests/phpunit/misc/test_FrmMisc.php b/tests/phpunit/misc/test_FrmMisc.php index d3504e7411..e262db6ca5 100644 --- a/tests/phpunit/misc/test_FrmMisc.php +++ b/tests/phpunit/misc/test_FrmMisc.php @@ -14,7 +14,7 @@ public function test_load_formidable_forms() { $this->assertTrue( isset( $frm_vars['load_css'] ) ); $this->assertTrue( isset( $frm_vars['pro_is_authorized'] ) ); - $this->assertNotEmpty( has_action( 'plugins_loaded', 'FrmAppController::load_lang' ) ); + $this->assertSame( 0, has_action( 'init', 'FrmAppController::load_lang' ) ); } /**