#40474 closed defect (bug) (invalid)
wp_ajax_(action) hook doesn't work in media gallery
Reported by: | hoandang | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7.3 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
Step to reproduce:
- Open an image in Grid view mode
- Change image title
- Add this hook in functions.php
<?php add_action('wp_ajax_save-attachment', function($array, $int) { var_dump('save-attachment'); }, 10, 2);
Expected: A var_dump result in http network.
Actual: http always responses {"success":true}
Change History (5)
#2
in reply to:
↑ 1
@
8 years ago
Sorry, I can't see the button to edit my post. Please see the fixed image http://i.imgur.com/pGF8Rku.png
Just to elaborate the bug, the ajax request comes from media gallery not from my custom ajax request. The hook works fine with "wp_ajax_save-attachment-compat" but "wp_ajax_save-attachment"
Replying to bhargavbhandari90:
Hi @hoandang
Not able to see anything from the url you provided. Is there something you want to point out by that url
#4
in reply to:
↑ 3
@
8 years ago
- Resolution set to invalid
- Status changed from new to closed
Just double-checked the doc and it states that the "wp_ajax_(action)" hook works only with custom ajax requests, so that explains the builtin wordpress ajax requests such as "save-attachment" don't work.
The issue seems to be a missing feature in wordpress, it is not really a bug.
Hi @hoandang
Not able to see anything from the url you provided. Is there something you want to point out by that url