Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#46721 closed defect (bug) (invalid)

admin-ajax not working correctly

Reported by: beaconmartinb Owned by:
Milestone: Priority: normal
Severity: major Version: 5.1
Component: Administration Keywords:
Focuses: ui, administration Cc:


So According to the Codex and a 12 Gold Badge wordpress.stackexchange member the following code should work, but it does not I think there is a bug in the add_action handler for 'wp_ajax' because the action is never being run.

So this is my simple test case:

class testClass {

    public function __construct(){
        echo "hello world";
        add_action('wp_ajax_beacon_podio-get_apps', array($this, "get_apps"));

    public function get_apps(){
            $app_id = $_POST['app_id'];
            die("Request is valid");
            die("Invalid request");
new testClass();

Testing with request to from browser with logged in admin account:

Expected Result

hello worldInvalid request

Actual Result

hello world0

The question an answer that made me think this is a bug: https://wordpress.stackexchange.com/questions/332878/wordpress-ajax-action-how-to-return-content

Change History (3)

#1 in reply to: ↑ description @beaconmartinb
3 years ago

Sorry the URL I'm testing within that is incorrect I'm actually testing with /wp-admin/admin-ajax.php?action=beacon_podio-get_apps as it is in the Stack Exchange link

#2 @donmhico
2 years ago

  • Keywords needs-codex removed
  • Resolution set to invalid
  • Status changed from new to closed

There's no bug for this ticket. Like what the reporter mentioned on comment 1. The correct url should be


and not

wp-admin/admin-ajax.php?action= wp_ajax_beacon_podio-get_apps

#3 @desrosj
2 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.