[wp-trac] [WordPress Trac] #42840: New plugin / theme editor wp_ajax_ save hook not working or inexistent
WordPress Trac
noreply at wordpress.org
Tue Dec 12 00:52:30 UTC 2017
#42840: New plugin / theme editor wp_ajax_ save hook not working or inexistent
---------------------------+-------------------------
Reporter: cristianuibar | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Editor | Version: 4.9.1
Severity: normal | Resolution: worksforme
Keywords: | Focuses:
---------------------------+-------------------------
Changes (by dd32):
* status: new => closed
* resolution: => worksforme
* milestone: Awaiting Review =>
Comment:
Hi @cristianuibar
As @birgire alluded to, this is because your action is hooked later than
when the core action runs, you'll need to hook in at priority 9 or lower:
{{{
add_action( 'wp_ajax_edit-theme-plugin-file', function() {
// Returns a failure for all edit attempts
die( '-1' );
}, 9 );
}}}
I'm marking this as `worksforme` as the above code works as expected.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42840#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list