Home › Forums › General Issues › Update_field for multiple Posts using one sql query › Reply To: Update_field for multiple Posts using one sql query
I forgot to mention that the update_field() is taking so long because the programs repeater field has about 60 sub-fields, including another repeater “locations” inside of it.
Maybe updating 300 (schools) * 60 (total fields) will just take this long? Was hoping for something sub 10 seconds, since 18000 updates seems like it shouldn’t take 60 seconds
I’ve also tried several “wp_importing” tricks, none of which have decreased the time to import
ex: set_time_limit(0);
ignore_user_abort();
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
$wpdb->query(‘SET autocommit = 0;’);
if (!defined(‘WP_IMPORTING’)) {
define(‘WP_IMPORTING’, true);
}
$wpdb->query(‘ALTER TABLE wp_postmeta DISABLE KEYS;’);
with appropriate cleanup after
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.