[wp-trac] [WordPress Trac] #43540: srcset not added when the original image size doesn't exist in the database after regeneration

WordPress Trac noreply at wordpress.org
Tue Feb 27 18:33:11 UTC 2024


#43540: srcset not added when the original image size doesn't exist in the database
after regeneration
--------------------------+------------------------------
 Reporter:  smerriman     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by citlembikk):

 It's not possible to change the default behaviour of wp-cron safely. If
 you filter on schedule_event and return an empty value, the cron function
 (wp_schedule_event etc that was originally called) will return false
 immediately.
 While this does cancel the default behaviour, it causes the function to
 return false rather than the default null. In well-written plugins, this
 will cause them to think the event wasn't scheduled or an error occurred.

 While wp_schedule_event and wp_schedule_single_event both call out to
 schedule_event, the other functions (wp_reschedule_event,
 wp_unschedule_event, wp_clear_scheduled_hook, wp_next_scheduled) don't.
 This means that you need to filter at a very low level (pre_option_cron)
 to be able to catch these, at which point you may be missing the data
 needed to work out what changed.

 I'd like to introduce a few new hooks here:
 pre_schedule_event to run at the top of wp_schedule_event and
 wp_schedule_single_event
 pre_reschedule_event to run at the top of wp_reschedule_event
 unschedule_event to run at the top of wp_unschedule_event
 clear_scheduled_hook to run at the top of wp_clear_scheduled_hook
 next_scheduled to run at the top of wp_next_scheduled
 These would all take false as their first parameter/filterable value, and
 act in the same way as pre_option_{$option} -- that is, you can return a
 non-false value, and the function would return that immediately.
 This would make the entire system pluggable, and allow swapping out the
 pseudo-cron for a real jobs system much more easily.

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


More information about the wp-trac mailing list