php - wp_set_object_terms() taking long execution time -
i'm working custom wordpress importer importing posts , other metadata using large csv file(may 40000 plus records in file). fine wp_set_object_terms()
taking long time during import process. there may multiple terms single post category,tags or custom taxonomy.
i'm using wordpress cron due large csv file , importing data after every 2 minute. cron executes after every 2 minutes , process records in chunks, pick 0-200 records 2nd time pick 200-400 records 400-600 , on.
but due wp_set_object_terms()
process taking more 2 minute , increases after each cron. 1st 200 records take 90 second 2nd 200 records take 93 , goes , after each cron.
foreach($terms_to_set $tax => $ids ){ wp_set_post_terms( $post_id, $ids, $tax, false ); }
the hosting guys told wp_set_object_terms()
query time consuming , is. after disabling process goes super fast.
so please let me know thoughts if have idea.
thanks in advance.
Comments
Post a Comment