[wp-trac] [WordPress Trac] #40474: wp_ajax_(action) hook doesn't work in media gallery

WordPress Trac noreply at wordpress.org
Sat Apr 22 12:25:18 UTC 2017


#40474: wp_ajax_(action) hook doesn't work in media gallery
--------------------------+----------------------
 Reporter:  hoandang      |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Media         |     Version:  4.7.3
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by johnbillion):

 * component:  HTTP API => Media
 * milestone:  Awaiting Review =>


Old description:

> Step to reproduce:
> 1. Open an image in Grid view mode
> 2. Change image title
> 3. Add this hook in functions.php
> {{{#!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}
>
> [[Image(https://doc-10-48-docs.googleusercontent.com/docs/securesc/ie7eo0n79gvn00ujkkueh6rd6bvedsbl/9e17est6nulkdde5iu0pvale99ina839/1492502400000/01498900461186215144/02963741754222276666/0B74Z16Mr59K5eUx4WU9Fb0x5WUU?e=view&nonce=3kg7l6jsf25pq&user=02963741754222276666&hash=lr8b0ro18bvsg43hmnmrqj3ptn67tilt)]]

New description:

 Step to reproduce:
 1. Open an image in Grid view mode
 2. Change image title
 3. Add this hook in functions.php
 {{{#!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}

 [[Image(https://i.imgur.com/pGF8Rku.png)]]

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40474#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list