Running the localize script after the script.min.js file
If that is the script you’re trying to localize, which you enqueued using the script handle mild-scripts
, then you also need to use that as the script handle when calling wp_localize_script()
. I.e.
wp_localize_script(
'mild-scripts', // script handle
'WPURLS', // JS object name
array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'site_url' => home_url(),
)
);