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?
- 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-to implement admin Ajax inside an admin WP_List_Table?
- Why Does get_posts() Return an Empty Set?
- Using AJAX in FrontEnd with WordPress Plugin Boilerplate (wppb.io)
- get_posts / WP_Query Memory size of 134217728 bytes exhausted
- How to find attachment ID for first image in a post
- How to enable users to down-vote in this simple voting counter (that uses the post meta)?
- Adding callback function for wp_ajax_ has no effect
- Cannot access current post’s ID in custom plugin
- Plugin Settings not Saving on Ajax re-ordered table
- Timeout on Admin-Ajax?
- Admin-ajax.php appending a status code to ajax response
- Comment `Reply` link doesn’t work if comments are loaded from ajax
- Ordering posts by metadata
- Ensure function has completed before allowing another Ajax call
- Fetching the value of forms in WordPress AJAX
- include wp-blog-header not working on MAMP
- Any problem in using native jquery ajax style instead of using admin-ajax.php?
- Show special field when correct shipping is chosen
- get_posts() not working when accessing with a custom user role
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- Including the necessary functions for a custom ajax registration form
- How to localize admin.php only once
- Dashboard – get status and position of metaboxes and pass them to ajax method
- Create a new post using rest api and save featured image using an external image url
- how to search users by ajax live search
- wp_set_object_terms not updating database without a die()
- wp.template() returns tags in Ajax response
- Fatal error: Uncaught Error: Call to undefined function get_option()
- Get attachments for posts that belongs to a specific category
- How to get post content by get_posts function?
- template_redirect or admin-ajax.php?
- Why does my widget break other widgets?
- how to get context information inside my funcion
- What’s wrong with this post__not_in argument?
- AJAX form post returns 0
- How I can use order by of the custom post title?
- Bad Request in AJAX
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- Run a function when new image is uploaded in media library
- Ajax submit result opens in admin-ajax.php
- insert query on a custom table using ajax with jQuery plugin Jeditable
- Plugin AJAX Save to Custom Table
- my basic php code producing unexpected results
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- AJAX call to admin-ajax.php by subscriber returns home page
- Ajax function is not working on WordPress
- About a programming language starts with [closed]
- Best practice for plugin: always detect admin-ajax call?
- Why is the form not updating when I select a new sector from the list?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- AJAX request not routing through proxy
- How to Show Category List With Corresponding Links?
- Get cat parameter from admin-ajax
- Ajax on the Administration Side of plugin – returns 0
- Ajax action has 200 status but response of No response data available for this request
- Post form – AJAX won’t upload featured image – Plugin development
- Condition to check previous next article post title
- 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?
- Forbidden Error in ajax call with wordpress
- “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
- WordPress Ajax not returning Response
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- 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
- How to get values from Tinymce visual editor popup?
- How To do Ajax In WordPress Custom Plugin?
- PHP includes with AJAX actions
- Ajax call not working with
- WP Ajax on page load not working on bluehost but was working on Godaddy
- Ajax not working to insert, query and result data
- Custom query not working in plugin admin page
- Attach an image to new posts
- Can’t get query string in ajax call
- Ajax url value to pass ‘variable’ to use in query
- An adiitional function fires on my AJAX submit
- Fatal error: Call to a member function query() on a non-object in my ajaxpage
- How do I query posts and have their related taxonomies returned in the results?
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Why my admin-ajax url returns 0 even after adding echo and die() at the end of function?
- filter on get_posts efficiently
- WordPress plugin boilerplate AJAX functionality
- How to add extra EXIF data when images are uploaded?