File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -542,11 +542,8 @@ class="libre-form libre-form-<?php echo esc_attr( $id . ' ' . $xclass ); ?>"
542542<?php
543543 $ output = ob_get_clean ();
544544
545+ // enqueue our footer script here
545546 wp_enqueue_script ( 'wplf-form-js ' );
546- wp_localize_script ( 'wplf-form-js ' , 'ajax_object ' , array (
547- 'ajax_url ' => admin_url ( 'admin-ajax.php ' ),
548- 'ajax_credentials ' => apply_filters ( 'wplf_ajax_fetch_credentials_mode ' , 'same-origin ' ),
549- ) );
550547
551548 return $ output ;
552549 }
@@ -570,6 +567,12 @@ function maybe_enqueue_frontend_script() {
570567 WPLF_VERSION ,
571568 true
572569 );
570+
571+ // add dynamic variables to the script's scope
572+ wp_localize_script ( 'wplf-form-js ' , 'ajax_object ' , array (
573+ 'ajax_url ' => admin_url ( 'admin-ajax.php ' ),
574+ 'ajax_credentials ' => apply_filters ( 'wplf_ajax_fetch_credentials_mode ' , 'same-origin ' ),
575+ ) );
573576 }
574577
575578
You can’t perform that action at this time.
0 commit comments