@@ -131,17 +131,20 @@ public function boot(): Plugin
131131 // init api
132132 $ this ->initApi ();
133133
134+ // Fetch the priorities from the config file
135+ $ priorities = $ this ->config ('plugin.priorities ' , []);
136+
134137 // Fires after WordPress has finished loading but before any headers are sent.
135- add_action ('init ' , [$ this , '_init ' ]);
138+ add_action ('init ' , [$ this , '_init ' ], $ priorities [ ' init ' ] ?? 10 );
136139
137140 // Fires before the administration menu loads in the admin.
138- add_action ('admin_menu ' , [$ this , '_admin_menu ' ]);
141+ add_action ('admin_menu ' , [$ this , '_admin_menu ' ], $ priorities [ ' admin_init ' ] ?? 10 );
139142
140143 // Fires after all default WordPress widgets have been registered.
141- add_action ('widgets_init ' , [$ this , '_widgets_init ' ]);
144+ add_action ('widgets_init ' , [$ this , '_widgets_init ' ], $ priorities [ ' widget_init ' ] ?? 10 );
142145
143146 // Filter a screen option value before it is set.
144- add_filter ('set-screen-option ' , [$ this , '_set_screen_option ' ], 10 , 3 );
147+ add_filter ('set-screen-option ' , [$ this , '_set_screen_option ' ], $ priorities [ ' set_screen_option ' ] ?? 10 , 3 );
145148
146149 static ::$ instance = $ this ;
147150
0 commit comments