add_action and add_filter always return true.
And yes, in PHP, any string that is not empty or “0” is loosely equal to the boolean true.
And I see nothing wrong with your die code. It’s hooked to wp_ajax_my_action, so you need to make a call to the admin-ajax.php as an authenticated user, with the my_action request. Then it will die.
Related Posts:
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Show spinner GIF during an $http request in AngularJS?
- How to check if I am in admin-ajax.php?
- Ajax in a settings page (update_option is undefined)
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- Ajax and autocomplete
- Load tinyMCE / wp_editor() via AJAX [duplicate]
- Saving (Updating) Post / Page Edits With AJAX
- Is there a hook that fires before an ajax call?
- How to correctly load wordpress in a non WP script for AJAX request
- Minimal WordPress load for only `get_option` to work (because ajax…)
- Plupload in metabox – AJAX action not working in Class
- Admin Ajax always return 0 on form submit
- Why this plugin doesn’t work with media upload page?
- CPU usage: AJAX and Heartbeat API on admin pages
- Confused on AJAX submit form through page template
- Ajax call in wordpress not working for subscriber user in front site
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Can part of my WordPress website be headless?
- Nonces, AJAX, script variables & security in WordPress
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- Why does WordPress Heartbeat login not refresh the nonces?
- wp_localize_script escaping my url – fix or alternative
- Insert wp_editor on front-end with AJAX?
- Admin Ajax and HTML5 Formdata
- Buddypress: Load Ajax Without Template Pack [closed]
- Woocommerce Ajax Add cart not working
- I have to post data by AJAX in wordpress to another Website
- Placement of add_action() for ajax callback?
- WordPress ajax problem need wordpress expert?
- Identical wp_rest nonce returned from rest_api
- Ajax WordPress Login needs to be stayed in current page Url without redirecting
- wp_ajax function did not call
- wp_handle_upload returns empty error array
- How do I query posts by a sub value with the API?
- Popup or admin/update notice on post/page edit screen without page refresh
- Single page site + pushState?
- Interim-Login form on frontend
- WordPress ajax call returns a zero though die()
- Save value from Javascript object to WP user
- wp_update_post onclick button using ajax
- add Additional class to woocommerce cart-contents link
- Ajax insert or update data
- Check ajax triggered from front-end or from dashboard
- Add Ajax to rating button
- wp_ajax declaration confusing for Front end
- Delete ACF repeater field row on Front End
- No errors in the console but Ajax call doesn’t seem to be working
- Preprocess submitted data
- Update status, meta while inside a post using AJAX button
- How to disable drag-and-drop upload function in Media Library?
- WP_query offset seems to be counting draft post – AJAX load more
- Can’t retrieve any content from Ajax-loaded page
- Deny dashboard access breaks ajax requests
- Run javascript upon successfully set featured image
- update_option in WordPress AJAX
- ajax in admin menu
- admin-ajax.php not loading anymore
- How to load dynamic option with ajax
- admin-ajax.php returns 0 even when the post status code is 200 OK
- Why is the file not uploading to the server?
- Get localize of a loaded javascript
- is there’s a way to get the next page content generated by page break block with ajax call?
- REST public POST giving 403 forbidden nginx
- Query data after an Ajax insert
- How to get next and previous post into ajax formed modal windows?
- Passing value from select form with Ajax not working
- Sending email through Ajax without page refresh hangs on admin_ajax.php
- Is there a public ajax endpoint?
- Why Ajax Doesn’t Work?
- Content including hooks inside wp-settings.php are being called twice in WordPress
- Problem when sending file via ajax
- wp_verify_nonce not working on the mobile device
- Frontend AJAX Media Upload returning 404
- JS global variable doesn’t update
- 404 error custom post type rest api
- Change button text after ajax db update
- How to implement AJAX within a class storing shortcode atts as class variables
- Jquery wrap permalink in a data-attribute?
- How do I display posts of a specific day?
- (Frontend AJAX) get post data WITH image thumbnail?
- Load .php file into div using ajax
- Native WordPress Video Shortcode Not Working After Post is Loaded via Ajax
- Ajax Function call is always returning 0 in front end(without plugin) [closed]
- AJAX Post from same domain to a wordpress page
- Ajax live search, “No products found” when the title contains apostrophes and quotations
- Add Ajax loaded posts to existing posts
- Using AJAX for dynamic settings pages
- Speeding up admin-ajax.php
- admin ajax is not working for non logged in users
- Change search to outpout category name instead of Post type name
- ‘Dehighlighting’ navigation once clicked
- wp_localize_script not create variable in head section
- AJAX admin Internal 500 error Failed to Upload
- Class property not visible inside ajax callback function?
- $wpdb Ajax not redirecting to main page
- how reduce fetch/XHR response time
- wordpress ajax bad request 400
- Custom WP rest api endpoint only working on non https?