wp_localize_script()
doesn’t care much which script handle you use as long as it is a valid one. You could use your theme’s or Elementor’s main script handle with the function to make the data available for your script. You’ll need to check your theme’s or Elementors source coude to find what these handles are.
Side note: It says on More information on the documentation that it is nowadays recommended to use wp_add_inline_script()
to provide data to scripts as
wp_localize_script()
should only be used when you actually want to
localize strings.
Related Posts:
- Nonces, AJAX, script variables & security in WordPress
- how to send Ajax request in wordpress backend
- How to get a unique nonce for each Ajax request?
- Is there a JavaScript API? How to access public and private data in JS?
- Nonces and Cache
- Is it safe to assume that a nonce may be validated more than once?
- Multiple ajax nonce requests
- Using Nonces for AJAX that only retrieves data
- How to verify nonce from Bulk/Quick Edit in save_post?
- How to add WordPress nonces to ajax request
- Nonces and Ajax request to REST API and verification
- jQuery Autocomplete not working with wp_localize_script
- Ajax function returns -1
- Serving nonces through AJAX is not refreshing nonce, returning 403 error
- Can’t seem to get wp_localize_script to work
- wp_verify_nonce always returns false when logged in as admin
- ajax and nonce when JavaScript is in a seperate file
- wp_verify_nonce doesn’t return true on server when it matches the nonce
- How to localize inline script called with ajax
- AJAX requests broken due to HTTPS for wp-admin
- Why does WordPress Heartbeat login not refresh the nonces?
- Ajaxing in functions.php
- wp-admin AJAX with Fetch API is done without user
- How do I check if AJAX nonces are implemented correctly?
- How to check an ajax nonce in PHP
- Can a wp_nonce created from domain 1 to be verified on domain 2?
- Identical wp_rest nonce returned from rest_api
- Populate a Map at The Same Time as showing Posts via AJAX
- wp_localize_script not working on ajax response
- WP Admin AJAX Security – using POST to include a relative URL
- wp_create_nonce() in REST API makes user->ID zero
- ajax nonce verification failing
- SSO autologin WordPress + Ajax
- How to make tabulator ajax call in wordpress?
- Admin-Ajax Error
- Nonce fails on ajax save
- Why is wp_localize_script returning false?
- Unable to successfully verify nonce
- Ajax call with javascript in post content (not enqueued)
- How to add ajax url to js using wp_add_inline_script()?
- Cache plugins and ajax nonce verification
- Nonce doesn’t validate in nopriv call
- Why does check_ajax_referer give a 403 error on https websites?
- WordPress is creating nonce as a logged in user but verifying it incorrectly
- javascript ajax and nonce
- How to check nonce lifetime value of plugins?
- WordPress Ajax Filter
- Using nonce when loading posts with AJAX
- Is there a better way to access transients using javascript
- How to load dynamic option with ajax
- Why the wp_localize_script() does not work correct in my case? ( /wp-admin/admin-ajax.php 400 (Bad Request) )
- Get localize of a loaded javascript
- Should wordpress nonce be placed in html form or in javascript file
- How to Object.freeze wp_localize_script
- wp_verify_nonce not working on the mobile device
- How do I mitigate replay attacks when talking about actions that shouldn’t happen twice?
- Ajax is not defined
- AJAX form not working, still reloads on submit
- Ajax WordPress pass post URLs
- Ajax Security regarding user priviliges and nonces
- How to use nonces for frontend AJAX voting if the page gets cached?
- wp_localize_script not create variable in head section
- jQuery’s .on() method combined with the submit event
- Why is die() used at the end of function that handles an Ajax request?
- Making my AJAX powered WordPress Crawlable
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
- admin-ajax.php doesn’t work when using POST data and Axios
- Custom Form with Ajax
- How to process ajax requests correctly using ajax plugins
- get_posts empty when called via Ajax
- WP-API and Basic Auth returning 403 on POST but not GET
- Is there a hook to process a backbone restful PUT request inside wordpress?
- How to localized one js file for different actions?
- wordpress and add actions to button by coding
- Get Author Post on author.php with AJAX
- AJAX and -1 response
- Update Data parameter of a wp_localize_script() call
- Ajax Call 400 Bad Request error with POST request but not with GET request
- While Ajax is working well, media upload isn’t showing the imagines
- How can I call an api before user login
- Problems with wordpress nonces in Ajax call
- Get post content and show it in a div
- why does not work ajax that add_action registered in wordpress
- How to get post from pure frontend AJAX (using only post ID)?
- Multiple AJAX requests using the same ajax_object.ajaxurl
- Filter custom post types by custom field using AJAX
- Refresh loop of custom posts (div) after new post is published
- Updating failed. The response is not a valid JSON response. specific to my browser when I include javascript in my html
- Ajax call returning 0 in page template
- AJAX action returning empty posts array?
- Cannot add multiple single images at once
- WordPress Ajax JSON success return no being recognized
- WordPress page content only in fancybox except direct click
- Ajax takes 10x as long as it should/could
- How to use AJAX to check if user is still logged-in?
- Ajax navigation and scripts loaded only on certain pages
- Closing ajax function file with die() causes error and empty page
- How to load wordpress sidebar using AJAX [duplicate]
- Adding custom fields to Wired Impact Volunteer Management Plugin
- How to update my jquery/PHP function to add/remove user as favorites in (WordPress) users list