OK, so you misunderstood it a little bit, I guess…
You do the first part correctly. So yes – AJAX requests should be sent to wp-admin/admin-ajax.php
and the should have action
param set in the request (either as a POST or as a GET).
But then, you do it wrong. You register your action with this code:
add_action('beacon_podio-get_apps', array($this, "get_apps"));
But id should be:
add_action('wp_ajax_beacon_podio-get_apps', array($this, "get_apps"));
or (for anonymous users)
add_action('wp_ajax_nopriv_beacon_podio-get_apps', array($this, "get_apps"));
So just to make it clear – the correct hooks are:
wp_ajax_(action)
wp_ajax_nopriv_(action)
where (action) is the action that you sent as action parameter.
Related Posts:
- Using Ajax with a Class file
- Are ‘wp_ajax’ and ‘wp_ajax_nopriv’ exclusive to authenticated and non-authenticated users?
- How to modify wp_ajax function?
- Ajax Request not coming back to class
- wp_ajax action is not running
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- add_action and Ajax
- WordPress Ajax Problems
- Placement of add_action() for ajax callback?
- admin-ajax.php ” Missing argument 2″ warning
- Code run fast on a cronjob but slow with a do_action or ajax call
- WordPress action – Pass arguments into action in an AJAX call?
- why does not work ajax that add_action registered in wordpress
- wp_ajax action is not run when ajax trigger
- Sharing variables in both actions wp_footer and wp_ajax
- Ajax callback not work
- admin-ajax.php calls fail if referrer is sent with 500
- How to run an ajax call in elementor editor
- do_action won’t work in ajax callback
- Ajax call works for logged in users and returns “Bad Request” for guests [duplicate]
- Its possible to ajax update the content of the admin custom post type list
- Trigger action via button
- Why function called by admin-ajax executes synchronously?
- where does my function output from load-* go?
- Static var overwritten with WP AJAX action, works fine without AJAX
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- JavaScript implementation of Gzip
- WordPress AJAX with Axios
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Get Previous & Next posts by Post ID
- Nonces and Cache
- REST API endpoint for elasticpress autosuggest
- ajax – why multiple calls to wp_create_nonce() return same value?
- AJAX request on the frontend always returns 0 if user is not admin
- Using ajax on categories and wordpress loops
- Why can’t I hook into save_posts after admin_init?
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- wp_remote_get() to get AJAX url /wp-admin/admin-ajax.php
- Can’t seem to get wp_localize_script to work
- Ajax – gettext without a plugin
- WordPress AJAX calls not detecting language properly?
- AJAX issue – Uncaught SyntaxError when processing Zip File
- wp_verify_nonce doesn’t return true on server when it matches the nonce
- update_user_meta doesn’t work with AJAX
- Ajax stops working when logged in?
- WordPress ajax get content post id
- Using wp_handle_upload and media_handle_sideload with ajax
- Load ajax if is_home()
- How to know what page is calling admin-ajax.php?
- Populate a Map at The Same Time as showing Posts via AJAX
- wp_localize_script not working on ajax response
- Get wp_title wp ajax
- Why Does WordPress not output admin-ajax.php path by default?
- Ajax custom search not functioning as expected
- Jetpack Infinite Scroll – Add more than 7 posts each time?
- Speed/Performance difference between `wp_ajax` and `init` checks for AJAX/POST requests?
- Test WordPress api with postman
- Remove trailing 0 from function that is used both statically and dynamically
- How to load next and previous posts by Ajax
- Update attachment metadata fails
- Nonce fails on ajax save
- Disallow second login session
- WordPress P2 live problem
- All AJAX requests return a 400 error
- Unable to successfully verify nonce
- Create custom POST Method URL
- Getting a variable using $post ajax back from php to js response in WP
- Custom Login with Ajax not working with IE
- AJAX jQuery post frontend returning failed to load resource status 400
- ajax form is returning the dreaded “[HTTP/1.1 400 Bad Request” and a zero
- How to check nonce lifetime value of plugins?
- How can I wp_send_json data?
- Front end theme options ajax returns 0
- Use AJAX in a WordPress Plugin to Get Data From Custom Database?
- Custom RPC end-point security best pratice?
- AJAX – SHORTINIT set to TRUE returns blank
- How to make image in TinyMCE clickable
- How to use Jeditable plugin with admin-ajax.php?
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- Disabling ajax code that does a POST request that ends in a 400 error code
- How to prevent my external API call from being called by anyone but me (my site)
- Ajax not sending the data correctly- Multidimensional array
- Registration form AJAX check for existing username (simple version)
- Syntax error on query_vars while handling with Jquery
- Want to send ajax request in wordpress to a custom file in plugin
- how to get password from user instead wp-generate-password
- Sending email with wp_email and AJAX
- How to use nonces for frontend AJAX voting if the page gets cached?
- AJAX Call in Plugin Returns More than JSON
- Ajax Form seems to post, but does not return
- Why can wordpress not find the actions I add in my constructor?
- delete attachment for one post without deleting actual attachment post
- Memberpress isn’t cooperating with WooCommerce
- Facebook Pixel + WooCommerce + AJAX = Confusion
- Add “load more” functionality to an AJAX response
- weird Internal Server Error – no error log produced
- Why are the most recent posts not appearing in a fetch request, unless I’m logged in?
- Successful ajax call returns lots of whitespace and text of code with 0
- How to submit a button automatically after every scheduled hours?
- At what stage does wp_ajax hooks gets applied during WordPress request?