[wp-trac] [WordPress Trac] #40161: Wrong documented or coded 'schedule_event' filter

WordPress Trac noreply at wordpress.org
Sat Mar 18 16:08:45 UTC 2017


#40161: Wrong documented or coded 'schedule_event' filter
-----------------------------------+------------------------------
 Reporter:  esemlabel              |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Cron API               |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------
Changes (by swissspidy):

 * keywords:  has-patch reporter-feedback => has-patch 2nd-opinion


Comment:

 > But many of other developers will produce error when hook in to their
 even with filter […] , because they can't predict if anyone else will use
 such way to prevent event from running.

 But that's the same with every filter out there, isn't it? That's why I
 added a more strict check in my previous example.

 If you understand you correctly, with [attachment:40161.patch] you want to
 say "don't just return false, but set the hook property to a falsey value,
 so others don't run into problems". If so, then I think
 [attachment:40161.patch] is not enough and this would need to be adjusted
 in the documentation as well, to educate developers.

 However, returning false in a filter to short-circuit something is a
 common pattern in WordPress and in this particular scenario I don't see
 much value in changing this. I mean, all the plugins out there using this
 filter won't suddenly change their code. You'd still run into the same
 problems.

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


More information about the wp-trac mailing list