[wp-trac] [WordPress Trac] #27736: Save one query when inserting a new post
WordPress Trac
noreply at wordpress.org
Wed Apr 9 13:31:36 UTC 2014
#27736: Save one query when inserting a new post
-------------------------------+-----------------------------
Reporter: ozh | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
The workflow when inserting a new post is the following :
1) `wp_insert_post()` sets a few vars (post type, post status, ...),
updates `$wpdb->posts`, then calls `wp_set_post_categories()`
2) first thing `wp_set_post_categories()` wants to know is `$post_type`
and `$post_status`, for which it performs an SQL query, instead of getting
this info from caller function
Same things goes for `wp_insert_attachment()`
Patch passes extra optional parameters `$post_type` and `$post_status` to
`wp_set_post_categories()`, to save one query when adding a post, or a
whole bunch when importing a batch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27736>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list