Read this response on how to properly use AJAX in plugins. If you just call a PHP script directly, WordPress is not loaded so no WP functions are available.
Related Posts:
- Posts form with AJAX request – Plugin development
- ajaxurl not defined on front end
- Why does WordPress add 0 (zero) to an Ajax response?
- Custom collection in media manager?
- How to return only certain fields using get_posts()
- Saving data-URI to media library
- Nonces can be reused multiple times? Bug / Security issue?
- How can I run AJAX on a button click event?
- Can I use the wp media uploader for my own plugin?
- How-to implement admin Ajax inside an admin WP_List_Table?
- What is nonce and how to use it with Ajax in WordPress? [duplicate]
- Empty POST data on server on AJAX request using Angular $http
- Why Does get_posts() Return an Empty Set?
- Using AJAX in FrontEnd with WordPress Plugin Boilerplate (wppb.io)
- Build path for a custom portfolio plugin
- Using AJAX in a plugin to submit form – REALLY confused
- wp_localize_script $handle
- get_posts / WP_Query Memory size of 134217728 bytes exhausted
- How to find attachment ID for first image in a post
- Add an image gallery to a custom post type?
- How to enable users to down-vote in this simple voting counter (that uses the post meta)?
- How to get posts by content?
- Adding callback function for wp_ajax_ has no effect
- get all products of one category
- Cannot access current post’s ID in custom plugin
- How to use WP default post list tables in a plugin?
- Ajax action has 200 status but response of No response data available for this request
- Jquery php request is returning a weird result
- WordPress Does not grab the string sends useing AJAX response, wp_ajax hook
- Post form – AJAX won’t upload featured image – Plugin development
- How to create a custom post-new.php page for plugin , no wp menu
- Condition to check previous next article post title
- Is there a way to get rendered html content of a WP post after updating?
- How to show the posts listing on dashboard or custom page in admin panel?
- GET request return value as error instead of success
- How to control ajax calls without effecting memory of server?
- Bad request 400 using class based files
- Forbidden Error in ajax call with wordpress
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- “add to cart” links css class “ajax_add_to_cart” doesn’t show in woocommerce in widget sidebar
- ajax stopped working when not logged in wordpress
- ajax call return 406 not acceptable for non logged users only
- Does $this context change in an AJAX callback?
- how to create a shortcode from a variable in plugin
- ajax response strips multidimensional array and unable to decode
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Unable to delete attached file from folder programmatically
- Rate limiting ajax requests in WordPress
- WordPress Ajax not returning Response
- ajax-action.php can’t find added action
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- AJAX call of function containing javascript which is not loaded (Plugin development)
- Performing ajax request in wordpress
- Inserted data from database does not showing on front-page without referesh page?
- wp_ajax function return the html page
- $_SESSION inside php function executed by AJAX
- Two same AJAX calls – one is working, other doesn’t
- ajax multiple Values
- How to include files in the loop via ajax
- How to handle ajax Request in a complex-structured plugin?
- Using JavaScript in WordPress page to call for server data using AJAX
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Filterable posts using categories
- How to get values from Tinymce visual editor popup?
- Ajax Response Error | just getting error as the response
- Unexpected issue when using attachment_fields_to_edit filter
- How To do Ajax In WordPress Custom Plugin?
- PHP includes with AJAX actions
- admin-ajax.php returns “No Script Kiddies!” sometimes
- WordPress function is not called and ajax return 0
- Ajax call not working with
- Ajax functionality not being called under wordpress plugin
- Array/List Edit in Backend
- WP Ajax on page load not working on bluehost but was working on Godaddy
- Ajax not working to insert, query and result data
- WP Cron as Fast as WordPress AJAX?
- Issue on Getting WP Gallery Items In cpt-single.php As Attachments
- Custom query not working in plugin admin page
- WordPress plugin: admin-ajax.php not passing data to custom function
- Attach an image to new posts
- Can’t get query string in ajax call
- Ajax url value to pass ‘variable’ to use in query
- Ajax functions – no access to wp-admin.php only online
- Bulk Attach Or Insert Media To Post Without Opening Post Editor
- Capturing POST data
- An adiitional function fires on my AJAX submit
- Fatal error: Call to a member function query() on a non-object in my ajaxpage
- Page reload occurs before request finishes
- How do I query posts and have their related taxonomies returned in the results?
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Return custom product in ajax call loop
- Why my admin-ajax url returns 0 even after adding echo and die() at the end of function?
- filter on get_posts efficiently
- A better way of getting draft posts that has a particular post meta using get_posts function
- WordPress plugin boilerplate AJAX functionality
- How to add extra EXIF data when images are uploaded?
- Issue in Creating Dynamic URL in custom wordpress plugin
- Does a wordpress custom plugin is fired by default on php theme ajax request?
- Can’t delete reported post