[wp-trac] [WordPress Trac] #28461: Add a fallback parameter to get_the_post_thumbnail() to find images
WordPress Trac
noreply at wordpress.org
Mon Apr 18 10:17:09 UTC 2016
#28461: Add a fallback parameter to get_the_post_thumbnail() to find images
-----------------------------+------------------------------
Reporter: krogsgard | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Thumbnails | Version: 3.9
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: template
-----------------------------+------------------------------
Comment (by flixos90):
This appears to be rather plugin territory to me.
What would be useful however to make this possible in a plugin is that we
could add a new filter `get_post_thumbnail_id` inside the function of the
same name. This would allow to override the post thumbnail - not actually
setting it though, but it would allow to add a fallback in the frontend.
We could also limit this filter to only be executed if there is no actual
featured image for that post.
To have this filter only be run in the frontend, we could add an
additional parameter `$filtered` with default `true` and explicitly set it
to `false` wherever calling it from the admin. Alternatively we could not
use the function at all in the admin - it is only used in one location
there anyway (most areas access the post meta directly), so we're a bit
inconsistent atm.
@krogsgard: Thoughts on this?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28461#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list