See documentation here but don’t miss the note 2 and the following points :
- AJAX on the front-end is more complicated, ajaxurl is not defined so
you have to call it with wp_localize_script(). - you have to use wp_ajax_nopriv_{action} for non logged in users
- there could be security issue !!!
About the third point :
Be careful because you give access to non logged in users to some data and functions. So you need to ask yourself about what you want to do. It could seem a little bit too much but to me when using AJAX on the front-end of WP you should make $_GET things, only for reading, for example infinite scroll ans stuffs like that, not delete, create and update actions.
Related Posts:
- How to load wp_editor via AJAX
- How Can I Securely Implement a Password-less Login Feature?
- Security and .htaccess
- Are there procedures to prevent malicious plugin updates?
- How to check plugins for malicious code?
- How to properly secure my WordPress installation?
- How can I pass a variable to wp_ajax action?
- Add image to post from external URL
- Where should my plugin POST to?
- Security error WP 4.0 + WP phpBB Bridge [closed]
- How to add a sub menu with AJAX?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- Execute a function using ajax
- Problem running Ajax in WordPress
- What’s the point of using WordPress’s built in admin-ajax.php?
- Questions about brute force attacks on the admin username, coming from amazon IP addresses
- How to expire all wordpress user passwords instantly?
- How can I reuse the WordPress search form for a custom plugin / widget?
- AJAX image upload with a upload progress bar using media_handle_upload
- jQuery Plugin to use WordPress functions in AJAX request
- Should you escape hardcoded URLs?
- Ajax gives 400 error
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Shortcode button dosent work for all posts. Work for first post only
- Simple ajax call not working in wordpress plugin
- How to delete Passwrd Protected posts cookies when a user logged out from the site
- What’s the best way to implement AJAX in WordPress?
- How to put JQuery/Ajax inside shortcode?
- __callStatic method handler passed to add_action causes bug in PHP
- Upgraded to latest version – 3.0.3 and Now I get a “sufficient permissions to access this page” error
- How to block plugin activations with no known user or coming from unknown IP address range?
- Check for security updates
- Standard Fail2Ban vs. WP Fail2ban vs. WP Fail2Ban Redux
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Ajax with plugins returns 0
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- Malicious File Upload [closed]
- Using AJAX to generate front end / viewer end pages
- Malware installation during plugin update?
- Post Comments with Ajax in WordPress
- Render Modula Plugin Shortcode On Ajax Request
- AJAX on Front-End Button Click not working – Custom Plugin
- How to handle WordPress Plugin Front-end AJAX Call [duplicate]
- AJAX Load more start with x posts
- How to protect WordPress from security scanner [closed]
- Create WordPress posts from JSON array using plugin in admin
- Adding inside wp-plugin jQuery script that receives JSON-formatted data, generated by php-function inside this plugin
- WordPress front end AJAX. Return 0 :?
- How to do the simplest possible frontend ajax call from a plugin?
- Using custom php file for ajax url inside plugin
- Asynchronous request in wordpress
- How do I localize admin-ajax.php that is used in Ajax Load More – Infinite Scroll?
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- Call Ajax URL in Plugin
- Calling a class method instantiated by ajax call in wordpress [closed]
- Loading by Ajax a plugin that also uses Ajax
- WP Insert Post If user refreshes override new post
- 404 errors when updating options in admin dashboard
- Website Captcha Error: The reCAPTCHA wasn’t entered correctly
- How to call php file in theme directory from plugin
- Can I disable xml-rpc by setting it to false?
- How can I adjust my function so the page editor still loads in the backend?
- Help to Create a Simple Plugin to make a post
- Error datatable whit ajax
- Facing Problem with admin-ajax.php URL – Getting 404 with AJAX call
- WP Ajax DB issues
- Calling PHP function with AJAX
- jQuery Ajax not loading page with ACF fields
- How achive serving multiple concurrent Ajax / Rest calls in plugin?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Overwriting Plugin’s Ajax callback function from theme
- admin-ajax.php not working properly on subdomains
- My ajax request don´t work and return 0
- Redux framework somehow added to my site, can’t locate in plugins
- Plugin with AJAX on subdomains causes 404 in console
- WordPress update plugin through Dashboard/Plugins displaying error
- wp_verify_nonce fails always
- Validating values using Settings API?
- display user input using ajax in wordpress
- Ajax, jQuery and WordPress
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- Contact Form loaded with Ajax
- How to load a plugin when doing an Ajax call? [duplicate]
- WordPress plugin ajax post parameter
- admin panel save option with ajax
- Capturing POST data
- Pulling Advanced Custom Fields from other pages
- Problem with permissions in wp-content/plugins
- Response from Php File to Ajax is not getting sent
- Plugin Admin Page Ajax-Admin call returning 0, URL set correctly. Implemented localized scripts but did not fix it
- Load css classes after using ajax calls
- My WP site and password was hacked, what to do? [closed]
- How to resolve these findings from security audit
- How to make a rest style plugin?
- WordPress portfolio pagination on home page
- wordpress Ajax success doesn’t return the value
- Ajax button “Load more” is not loading correct language version posts for logged out users
- Inline AJAX script passing variables to PHP
- wordpress admin-ajax bad request 400