Hi RonC & Josie
In my case, it appears that the problem was caused by a change in the execution order of the wp_localize_script() in the plugin code relative to the firing of the wp_enqueue_scripts hook. Apparently, in a block editor version of WP, the wp_enqueue_script hook firing is delayed so “when you try to enqueue a script simply using its handle, the script is not found in the list of the registered scripts. And, in turn, wp_localize_script/wp_add_inline_script
fail to find the handle to attach their data to.” – Thanks to @luigipulcini for the detective work.
In EntryWizard, my solution was to edit \entrywizard\includes\ewz-upload.php to comment out line 90 and replace it with the following:
90 // wp_localize_script( "ewz-upload", "ewzG_$webform_id", ewz_html_esc( $ewzG ));
//*** To replace preceding line and move execution of the rendering of ewzG_ object to the footer hook
$ewz_object = json_encode(ewz_html_esc($ewzG));
$ewz_object_name = 'ewzG_'.$webform_id;
add_action('wp_footer', function() use ($ewz_object_name, $ewz_object){
printf('<script type="text/javascript">var %s = %s</script>', $ewz_object_name, $ewz_object);
});
//*** End of change
The execution timing change also affected the EWZ-Ratings plugin which might be RonC’s issue. A largely similar change was also applied to \ewz-ratings\includes\ewz-rating-shortcode.php at line 286 (was commented out) using the following:
286 // wp_localize_script( "ewz-rating", 'ewzG1_' . $atts['rf_num'], array( 'gvar' => $ewzG ));
//*** To replace preceding line and move execution of the rendering of ewzG_ object to the footer hook
$ewz_object = json_encode(array( 'gvar' => $ewzG ));
$ewz_object_name = 'ewzG1_'.$atts['rf_num'];
add_action('wp_footer', function() use ($ewz_object_name, $ewz_object){
printf('', $ewz_object_name, $ewz_object);
});
//*** End of change
@ronc, the code immediately above might be helpful but I am not certain about the applicability to the theme you are using.
@joanne123, I am sure that there are better ways to implement this change but I was pressed for time and this is what I came up with.
Hope this helps and thanks again for a great plugin. Also, just an FYI the code comments were useful – I could not have figured this out without them.
DWTurner
-
This reply was modified 1 year, 1 month ago by dwturner.
-
This reply was modified 1 year, 1 month ago by dwturner.