[wp-trac] [WordPress Trac] #64186: has_filter()/has_action() do not support an expected $priority param

WordPress Trac noreply at wordpress.org
Tue Nov 4 00:45:19 UTC 2025


#64186: has_filter()/has_action() do not support an expected $priority param
--------------------------------------+--------------------------
 Reporter:  westonruter               |       Owner:  westonruter
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.9
Component:  Plugins                   |     Version:  2.5
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+--------------------------

Comment (by westonruter):

 In [changeset:"61119" 61119]:
 {{{
 #!CommitTicketReference repository="" revision="61119"
 Embeds: Add `wp_oembed_add_discovery_links()` to run earlier at `wp_head`
 priority 4.

 This results in the oEmbed discovery links being printed before scripts
 and styles are printed. This helps ensure they appear within the first
 150K bytes of the HTML response, which is required by
 `WP_oEmbed::discover()`. With increasing the `styles_inline_size_limit`
 from 20K to 40K in #63018, it becomes more probable that the oEmbed
 discovery links will be pushed out of range.

 For backwards compatibility with themes and plugins that disable the
 oEmbed discovery links by unhooking `wp_oembed_add_discovery_links()` from
 running at `wp_head` priority 10 (even though the `oembed_discovery_links`
 filter is available to disable such links), this callback is added a
 second time to run earlier at priority 4. The first time the function
 runs, it checks to see if the callback is still hooked at priority 10. If
 not, the function short circuits. If it is still hooked at priority 10,
 however, the function then unhooks itself at priority 10 so that it won't
 run a second time later during the `wp_head` action, before proceeding
 with printing the discovery links. A similar back-compat approach was
 taken previously in [60910]. The back-compat checks are only performed if
 the function is invoked during the `wp_head` action, allowing the function
 to be called "idempotently" elsewhere.

 Developed in https://github.com/WordPress/wordpress-develop/pull/10449

 Follow-up to [61118], [61117].

 Props westonruter, swissspidy.
 See #64186, #63018.
 Fixes #64178.
 }}}

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


More information about the wp-trac mailing list