File tree Expand file tree Collapse file tree
classes/Visualizer/Module Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,10 +252,21 @@ public function adminInit() {
252252 // fire any upgrades necessary.
253253 Visualizer_Module_Upgrade::upgrade ();
254254
255- if ( get_option ( 'visualizer-activated ' ) ) {
255+ $ activated_flag = get_option ( 'visualizer-activated ' );
256+ $ fresh_install = get_option ( 'visualizer_fresh_install ' , false );
257+ $ is_pro = Visualizer_Module::is_pro ();
258+ if ( $ activated_flag ) {
259+ if ( function_exists ( 'wp_doing_ajax ' ) && wp_doing_ajax () ) {
260+ // Defer redirect until a normal admin request.
261+ return ;
262+ }
263+ if ( wp_doing_cron () ) {
264+ // Defer redirect during cron requests.
265+ return ;
266+ }
256267 delete_option ( 'visualizer-activated ' );
257268 if ( ! headers_sent () ) {
258- if ( ! Visualizer_Module:: is_pro () && ! empty ( get_option ( ' visualizer_fresh_install ' , false ) ) ) {
269+ if ( ! $ is_pro && ! empty ( $ fresh_install ) ) {
259270 $ redirect_url = array (
260271 'page ' => 'visualizer-setup-wizard ' ,
261272 'tab ' => '#step-1 ' ,
You can’t perform that action at this time.
0 commit comments