The default response from admin-ajax.php
is,
die( '0' );
…by adding your own wp_die()
or exit()
or die()
after returning your desired content prevents the default response from admin-ajax.php
being returned as well.
It also generally means that your ajax call has succeeded.
Ultimately, to answer your question, it’s meant to work this way. What you are doing by exiting after returning your content is the right thing to do.
Related Posts:
- how to search users by ajax live search
- how to get context information inside my funcion
- WordPress Ajax not returning Response
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Ajax not working to insert, query and result data
- Fatal error: Uncaught Error: Call to undefined function get_option()
- Create custom HTML/JS app inside page
- How to add user details to different tables immediately after user registration
- Use just a shortcode from another page
- template_redirect or admin-ajax.php?
- mysql_real_escape_string() vs. esc_sql() in WordPress
- WordPress function get_the_terms() returns ‘Invalid taxonomy’ error
- Checking for existence of a page by title?
- WordPress class, using add_action to call member function does not work
- How to modify files inside wp-includes directory in wordpress
- Fatal error: Call to a member function get_page_permastruct() on a non-object
- wp_get_post_terms Order by not working
- AJAX form post returns 0
- Update Data parameter of a wp_localize_script() call
- Function/Class to list categories with checkboxes
- jquery & ajax sending data to php
- wp_localize_script is not adding a global variable for javascript
- wp_get_theme Warning: Illegal offset type
- Can’t get AJAX call working in custom plugin
- Why wp_die() doesn’t work with wp_redirect but exit() works
- Bad Request in AJAX
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- 400 Bad Request, in wordpress theme development, wp_ajax
- Ajax is not working in a loop
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- ajax recursive calls on wordpress returning answers outsite the function scope
- Ajax submit result opens in admin-ajax.php
- Print Dashboard submenu name and filename
- Using data sent via AJAX in multiple functions on a WP plugin
- Are there any security risks when submitting data-attribute data through AJAX?
- Autogenerate a Table of Contents
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- insert query on a custom table using ajax with jQuery plugin Jeditable
- How to get error object returned by wp_create_user
- Plugin AJAX Save to Custom Table
- WordPress multisite,use same cookies across all website?
- Apply styles to blockquote element with the WYSIWYG editor
- Call to undefined function is_home() or any conditional tags
- unregister_setting() vs delete_option() for plugin update
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- How to change WooCommerce loop product title HTML output in single product page and archive page
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- WP ajax requests not stacking?
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- AJAX button with success callback. (Titan Framework)
- How to output functions from plugin inside theme
- ajax working when function is on child theme but not in plugin page
- AJAX call to admin-ajax.php by subscriber returns home page
- wp_schedule_event is registered but function isn’t running
- AJAX call returns ‘testtest0’ instead of ‘test’ – why?
- Ajax function is not working on WordPress
- About a programming language starts with [closed]
- Best practice for plugin: always detect admin-ajax call?
- add_action wp_ajax_ not loading in plugin file WP Network
- Why is the form not updating when I select a new sector from the list?
- Overwriting a plugin function
- Workflow for new importer plugin – your advices?
- Writing editor content to a file
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Ajax +wordpress onClick link redirect to new page and create html content
- Execute Jquery when a specific page in my plugin is loading
- AJAX request not routing through proxy
- Remove Permalink Meta Box not working?
- Adding tables to dashboard pages programmatically?
- Setting post_id for single.php based on URL without a redirect
- using admin functions on frontend
- Javascript Function Called Too Early in PHP Script
- Modify code for functions.php with specific twitter user url and hashtags
- can’t access some WordPress function from my plugin
- WP 3-way voting system: On to something! Please help!
- Get cat parameter from admin-ajax
- Custom Settings Plugin Save foreach checkboxes
- Customise Grouped Product display in Woocommerce with custom column
- WordPress (pagenow link) in ajaxurl change after i change plugin language
- Change the behaviour of a button
- Ajax on the Administration Side of plugin – returns 0
- How to do admin ajax request in a plugin for rest api
- Can someone explain what’s the use of parse request function in WordPress?
- 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
- Posts form with AJAX request – Plugin development
- Add default value from selection
- GET request return value as error instead of success
- How to control ajax calls without effecting memory of server?
- function add custom fields to media gallery
- Bad request 400 using class based files
- Override category archive page title (not the head title)
- 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
- Make visible page only in the trash