[wp-trac] [WordPress Trac] #33723: Allow WP_Post on thumbnail functions
WordPress Trac
noreply at wordpress.org
Sat Sep 5 11:48:24 UTC 2015
#33723: Allow WP_Post on thumbnail functions
------------------------------------+-------------------
Reporter: Rahe | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.4
Component: Post Thumbnails | Version: 4.3
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses: docs
------------------------------------+-------------------
Changes (by swissspidy):
* keywords: => has-patch dev-feedback
* focuses: => docs
* milestone: Awaiting Review => 4.4
Comment:
Thanks for your patch! I think this enhancements makes sense as it is more
convenient for developers.
Unfortunately I wasn't able to easily apply it because of the base
directory. As a tip for next time, please make sure you patch from the
`/src` directory, so it looks like `src/wp-includes/post-thumbnail-
template.php` in your patch.
I created [attachment:33723.diff 33723.diff] now that does the following:
* Adds `@since` to the docblocks to reflect the changes
* Leaves `update_post_thumbnail_cache` alone. We don't do refactoring just
for the sake of refactoring, see
https://make.wordpress.org/core/2011/03/23/code-refactoring/ for details.
* Makes sure `$post` is a `WP_Post` in `get_post_thumbnail_id`, otherwise
uses `null`
Unfortunately these functions have no unit tests. We really should add
some, but maybe in a separate ticket.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33723#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list