use DATABASE_NAME; select p.post_title,t.name,p.post_content from wp_posts p, wp_term_relationships r,wp_terms t, wp_term_taxonomy tt where p.id=r.object_id and r.term_taxonomy_id=t.term_id and tt.term_id=t.term_id and tt.taxonomy='category';
withopen('posts.csv', newline='', encoding='utf-8') as csvfile: posts = csv.reader(csvfile) for post in posts: if post[1] == "name": continue post_title, category, post_content = post
set_post_dir(category) try: withopen(post_title+".md", "w", encoding='utf-8') as post_file: post_file.write(post_content) except Exception as exp: print(exp) print(f"category: {category}") print(f"title: {post_title}") print(f"content: {post_content}")