Not much noticeable when working with individual posts, but when you create or delete multiple thousands in bulk and by code – process is quite slow.
Are there any good tweaks to apply and corners to cut?
Context:
wp_insert_post()
with categories and tags passed;- add several custom fields;
- create and associate attachments (from existing files).
When updating post taxonomies, you can call
wp_defer_term_counting( true )
before you do your mass operation, and thenwp_defer_term_counting( false )
to update the term counts only once per term.