I guess you have a small misunderstanding here (a slight inconsistency only) add_action
is to register a callback for a hook-name, you actually want to fire that hook (not register it).
You can fire a hook with the do_action
function.
The Codex-page of the add_action
function outlines both:
And naturally the do_action
Codex-page has all the glory details:
Take care you don’t create an endless loop, that will crash PHP and therefore WordPress but it also shows that there are no limitations built in.
You can stack as many actions as you want to, even recursive action calls are possible.
Related Posts:
- Admin Notification after save_post, when ajax saving in gutenberg
- Detecting post type within init action
- wp_ajax_[service] returning 0
- Is there a hook that fires before an ajax call?
- wp_ajax action is not running
- Conditional action hooks
- Is there a hook to process a backbone restful PUT request inside wordpress?
- WordPress Ajax Problems
- Which allowed API hooks work to add wp_ajax action?
- Using admin-ajax prevents regular php form submission
- ajax problem – function on server is not called
- change wordpress pagination url after doing the request
- Refresh Gutenberg with JS for it show updated post
- Set cors header for ajax requests
- Is there a hook that fires after an ajax call?
- Content including hooks inside wp-settings.php are being called twice in WordPress
- Hook after all metadata are set is triggering several time
- Call public static method from ajax ‘wpcf7_mail_sent’ hook
- Why function called by admin-ajax executes synchronously?
- Trying to send AJAX data to WordPress hook
- WordPress blocking polling request when signed into Admin
- At what stage does wp_ajax hooks gets applied during WordPress request?
- Why use admin-ajax.php and how does it work?
- Using Backbone with the WordPress AJAX API
- WordPress Ajax Data Security
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
- How do I hook an Ajax request into a PHP callback?
- Gutenberg – how to correctly perform ajax request on backend
- get_template_part execute with ajax
- How to add WordPress nonces to ajax request
- How declare Ajax functions ussing SHORTINIT
- jQuery Autocomplete not working with wp_localize_script
- Load custom formatted comment with AJAX: reply link isn’t rendered?
- Is there a way to optimize function that is used for returning data in an ajax-call?
- WP REST API route request explain
- Ajax returning correct data BUT at wrong place
- admin-ajax.php mixed content
- Check if username exist with AJAX
- How to localized one js file for different actions?
- WooCommerce: Translation lost on AJAX call in Checkout page [closed]
- Async Loading of Custom Posts
- How to insert a record by clicking on the link using AJAX
- How can I access the Header of and ajax response from the rest API
- Getting back to ajax search results from a page
- Updating a checkbox value to database for specific row in table
- WordPress Ajax Not Working ( Custom Admin page)
- WordPress ajax success response
- Admin WP List Table Columns Missing
- (updated) How to add AJAX error handling to a (fully) custom registration form?
- wordpress admin ajax url rename
- rest_no_route custom route
- Using infinite scroll ajax load more with search parameter
- How get child posts in custom post type by ajax?
- contact form ajax empty response error message
- Cache wp-json/posts without a plugin?
- What is the best way to do MyAjax error and success handling?
- Gravity Forms closes my popup on Validation Error [closed]
- infinite-scroll for 2 fixed height containers
- Issue understanding and using WordPress filters and actions
- Attach time/date stamp on add_post_meta
- “Loadmore” button is not working in buddypress [closed]
- infinite scroll not working when logged out
- Right way to include blog-header.php?
- AJAX action through direct link
- Ajax call on new site with jupiterx theme getting 400 response [closed]
- Upload data from weather station to WordPress Website
- Ajax call in WordPress – unable to display the data on the page
- How to reuse get_template_part() containing a simple loop to work with AJAX correctly?
- Need help with ajax
- Using nonce when loading posts with AJAX
- Tabbed feeds with ajax vs. without on homepage [closed]
- Get title and featured image using Ajax
- javascript onClick update user_meta from jquery.ajax
- How to ignore WP_ERROR caused by “get_the_excerpt” method in an AJAX call?
- My function containing a mysql query launched by ajax is not working in wordpress. What am I missing?
- Not getting ajax success response on insert/update row to database
- Wp admin ajax load more
- wordpress ajax search posts
- enqueue style using admin-ajax.php
- How to safely pass post_id and user_id via AJAX to the backend (prevent user from changing it via JS)?
- Can’t get next post info with ajax
- How to inject data content from external json into a modal, using UIkit?
- Ajax by worpdress affects called jquery inside template file
- AJAX form not working, still reloads on submit
- How to paginate Ajax result
- Cannot access class properties from ajax call in wpordrpess
- why is my main.js not loading?
- Having a self updating list
- Enqueue dynamically generated javascript
- First time doing Ajax with WP, how to do it?
- Unexpected WordPress search results
- WordPress Get Header and Footer using in Admin Area
- ajax page template
- apply_filters, EMBEDS and AJAX not a friends? [duplicate]
- Using Javascript Callback from plugin in a theme
- Why does my Ajax Get request give a 400 bad request?
- How to get data with Select AJAX PHP
- Add “load more” functionality to an AJAX response
- Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php
- weird Internal Server Error – no error log produced