WordPress huge category CSV import don’t work

I have a 1,5 MB (with about 20.000 line) CSV file, and I would like to import my new worpdress site, but the code below don’t create all the categories, only part of it. I already increased max_execution_time = 2000,
max_input_time = 2000,
max_input_vars = 20000,
memory_limit = 1024M, but don’t work the code.

Can someone help me with what’s wrong?

ini_set(‘memory_limit’, ‘1024M’);
ini_set(‘max_execution_time’, ‘2000’);
register_activation_hook(__FILE__, ‘wpse_57865_activation_run’);

function wpse_57865_activation_run()
$file = file_get_contents( plugin_dir_path( __FILE__ ) . ‘categories.csv’ );
$data = array_map( “str_getcsv”, preg_split( ‘/r*n+|r+/’, $file ) );

if( count($data) < 1)

foreach( $data as $cat )
$cat_defaults = array(
‘cat_name’ => $cat[0],
‘category_nicename’ => $cat[1]


Read more here:: WordPress huge category CSV import don’t work

Leave a Reply

Your email address will not be published. Required fields are marked *