[wp-trac] [WordPress Trac] #37629: is_sticky filter hook
WordPress Trac
noreply at wordpress.org
Wed Sep 13 18:11:48 UTC 2017
#37629: is_sticky filter hook
-------------------------------+------------------------------
Reporter: greenshady | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 4.6
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------------+------------------------------
Comment (by greenshady):
Replying to [comment:1 tdmalone]:
> How about the `pre_option_sticky_posts` filter?
>
>
> There are other dynamic filters available in
[https://developer.wordpress.org/reference/functions/get_option/
`get_option()`] as well, which `is_sticky()` calls.
By running a filter on that hook, you're filtering an option that's
storing sticky posts of the `post` post type, not the result of the
`is_sticky()` function. There's potential for some unintended
consequences here when other code is calling `get_option( 'sticky_posts'
)`.
While the option and the conditional are related by default, this is not
necessarily true with custom sticky post implementations. Sticky posts
can be stored in a variety of ways. A filter hook for the conditional
function makes more sense in those scenarios.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37629#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list