So I have custom Wordpress theme in which i need to import some darta from CSV. Data consist of name, field, city, institution. 4060 lines. Everything except names I'm filtering before input to remove duplicates.
So the main problem is that it just stucks when I trying to import 4k of institutions. Institution is the string from 10 to 30 chars.
I already increased php timeout to 10 minutes and allowed memory to 1024mb. But still I get white screen (no errors) from time to time.
So will sleep
function help me if I add it in loop?
foreach ($sub_categories as $key => $sub_cat) {
$page = wp_insert_term($sub_cat, 'gp_hubs', [
'parent' => $category['term_id'],
'slug' => $this->_generateUniqueSlug($sub_cat)
]);
wp_set_object_terms($page['term_id'], self::MENU_ID, 'nav_menu');
wp_update_nav_menu_item(self::MENU_ID, 0, array(
'menu-item-title' => $sub_cat,
'menu-item-attr-title' => esc_attr( $sub_cat ),
'menu-item-object-id' => $page['term_id'],
'menu-item-db-id' => 0,
'menu-item-object' => 'gp_hubs',
'menu-item-parent-id' => $parent_menu_id,
'menu-item-type' => 'taxonomy',
'menu-item-url' => get_term_link($page['term_id'], 'gp_hubs'),
'menu-item-status' => 'publish'
));
sleep(3);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire