[wp-trac] [WordPress Trac] #43256: wp_delete_post() should use get_post() not wpdb->prepare
WordPress Trac
noreply at wordpress.org
Thu Feb 8 08:02:13 UTC 2018
#43256: wp_delete_post() should use get_post() not wpdb->prepare
-------------------------------+------------------------------
Reporter: charlestonsw | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 1.0
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------------+------------------------------
Changes (by swissspidy):
* focuses: performance =>
* version: 4.9.4 => 1.0
Comment:
One minor difference is that the SQL query will check whether the post
really exists (not just in the cache) whereas calling `get_post()` with
the wrong parameter (for example 0, the default for the function's
`$post_id` parameter) will retrieve and ultimately delete the global post.
That shouldn't happen of course and could be prevented with good unit
tests.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43256#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list