[wp-trac] [WordPress Trac] #45269: REST API: `rest_insert_attachment` and `rest_after_insert_attachment` actions fire twice on update.
WordPress Trac
noreply at wordpress.org
Sat Nov 3 23:40:51 UTC 2018
#45269: REST API: `rest_insert_attachment` and `rest_after_insert_attachment`
actions fire twice on update.
--------------------------------------+------------------------------
Reporter: peterwilsoncc | Owner: danielbachhuber
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.0
Component: REST API | Version: 5.0
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests | Focuses: rest-api
--------------------------------------+------------------------------
Comment (by peterwilsoncc):
I had some late shower thoughts on this, this-morning. Is it worth
allowing the if statement to be filterable to allow for custom endpoints
making use of a similar pattern to the attachments?
{{{#!php
<?php
$subclass_endpoints = apply_filters( 'rest_api_subclass_endpoints', array(
'attachment' ) );
if ( in_array( $this->post_type, $subclass_endpoints, true ) ) {
// etc
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45269#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list