Export to csv adding html to file

I have a similar process to output all email addresses from the database into a downloadable txt file. It looks like this: $xoutput = show_subscriber_list(); $xfile = fopen(‘xsubscriber.txt’ , “w”) or die(“Unable to open file!”);; fwrite($xfile,$xoutput); fclose($xfile); $filename=”xsubscriber.txt”; // of course find the exact filename…. header(‘Pragma: public’); header(‘Expires: 0’); header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0’); header(‘Cache-Control: private’, … Read more

Creating categories while importing via CSV

I was able to solve this by checking if the term exists, and then using tax_input in wp_insert_post() // Check if the category exists $category_term = term_exists(trim($category), ‘formula_types’, 0); // Create category if it doesn’t exist if (!$category_term) { $category_term = wp_insert_term(trim($category), ‘formula_types’, array(‘parent’ => 0)); } array_push($formattedCategories, (int)$category_term[‘term_taxonomy_id’]); $post = array( ‘post_title’ => $results[‘drug_name’], … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)