Opened 10 years ago
Last modified 5 years ago
#27736 new enhancement
Save one query when inserting a new post
Reported by: | ozh | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Posts, Post Types | Keywords: | has-patch needs-refresh |
Focuses: | administration, performance | Cc: |
Description
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.
Attachments (4)
Change History (11)
Note: See
TracTickets for help on using
tickets.
fix wp_insert_attachment() as well