admin_url()
should be used.
However for some websites this request gives error 404 in front-end
admin_url('admin-ajax.php')
should point to an actual file (admin-ajax.php
), as such WordPress won’t pass it through index.php
, and so it shouldn’t lead to the theme’s 404 page. (Unless the file has been deleted).
… unless you have a .htaccess
file which is redirecting the user away from wp-admin
(for example) (a recent client of mine had been doing this to whitelist IP addresses that could reach wp-admin
).
Related Posts:
- AJAX on Front-End Button Click not working – Custom Plugin
- How to handle WordPress Plugin Front-end AJAX Call [duplicate]
- How to do the simplest possible frontend ajax call from a plugin?
- AJAX doesn’t pass variables to the php function in the plugin
- How to load wp_editor via AJAX
- What could a hacker do with my wp-config.php
- Help with 4.6. Attachment response object in JSON API plugin
- Let readers suggest edits from the frontend
- Loading shortcode with ajax
- WP Config for FTP credentials
- How to notify users of blog updates a la Admin Plugin Update notifications?
- How to add a sub menu with AJAX?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- Execute a function using ajax
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Why is my ajax call refreshing the page?
- What’s the point of using WordPress’s built in admin-ajax.php?
- Admin-ajax.php is dying “0” without processing function
- Datepicker not supporting timepicker
- How to remove an Ajax action
- Get Plugin Information from Multiple Sites Externally
- Frontend editing, Frontend user dashboard
- plugings request url is the old url
- How to add pagination to wpbakery grid?
- How can I reuse the WordPress search form for a custom plugin / widget?
- Ajax gives 400 error
- Why plugin ajax response is -1?
- WordPress Ajax Callback
- plugin ajax to external php file always return null
- 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
- When to use action hooks and plugins
- Simple ajax call not working in wordpress plugin
- Implement Autocomplete for a custom field on WordPress Plugin Frontend
- Form isn’t inserting data into database with ajax plugin
- What’s the best way to implement AJAX in WordPress?
- __callStatic method handler passed to add_action causes bug in PHP
- jquery not calling php function
- Ajax with plugins returns 0
- WordPress + JavaScipt + AJAX + MySQL: insert query for form
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- Front end inline editing?
- Using AJAX to generate front end / viewer end pages
- wordpress file upload with ajax when site is ajaxyfi
- AJAX search as you type? [duplicate]
- WordPress api call using wp-ajax returns error 400
- Using wpdb without loading all plug-ins via wp-load.php
- Add script into front from my plugin
- Fullscreen Video/GIF Intro
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- Call plugin with php function
- AJAX Load more start with x posts
- Is it safe to use admin-ajax.php in the frontend?
- 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 :?
- Editing wp-config.php
- Proper way to handle admin-ajax calls
- 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?
- Ajax object not defined – JS file is in plugin folder
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- Call Ajax URL in Plugin
- WordPress API functions not working at AJAX functions.php call
- Calling a class method instantiated by ajax call in wordpress [closed]
- Loading by Ajax a plugin that also uses Ajax
- Categories from front-end, checkbox selection doesn’t work
- How can I adjust my function so the page editor still loads in the backend?
- Push Contact form 7 variable to front end after submission
- Error datatable whit ajax
- Trouble with AJAX using GET
- Calling PHP function with AJAX
- Adding LOAD MORE on a page
- WordPress wp get_temp_dir return non exiting folder, thus failing plugin & themes update
- WordPress User profile with Avatar upload on the front end without plugin?
- How to upload PDF from Front-End and post automatically?
- admin-ajax.php returning 0
- Update User Meta Via Ajax
- Compare Ajax Data Results
- User Following System
- cURL do not mimic click
- What action or filter can I use to change all the html returned from server for a page?
- Front End Page Not Loading Header Footer
- admin-ajax.php not working properly on subdomains
- What action/hook do I need to register to have my plugin handle front-end editing?
- My ajax request don´t work and return 0
- Plugin with AJAX on subdomains causes 404 in console
- How can I use wp_ajax_response for front-end error reporting?
- Not getting result using ajax on wordpress
- How to add featured image on front end form?
- display user input using ajax in wordpress
- Plugin constructor called multiple times
- WordPress plugin ajax post parameter
- 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
- Select posts from list and add them in a new list
- wordpress admin-ajax bad request 400
- Display Any Field fromAdmin Panel in Frontend via Shortcode?