If you want to export the data to a CSV or JSON file directly from the SQL query, you can use the MySQL INTO OUTFILE
clause.
SELECT wpd9_posts.post_title, GROUP_CONCAT(wpd9_terms.name) AS categories
FROM wpd9_posts
LEFT JOIN wpd9_term_relationships ON (wpd9_posts.ID = wpd9_term_relationships.object_id)
LEFT JOIN wpd9_term_taxonomy ON (wpd9_term_relationships.term_taxonomy_id = wpd9_term_taxonomy.term_taxonomy_id)
LEFT JOIN wpd9_terms ON (wpd9_term_taxonomy.term_id = wpd9_terms.term_id)
WHERE wpd9_posts.post_type="post"
AND wpd9_posts.post_status="publish"
GROUP BY wpd9_posts.ID
INTO OUTFILE '/path/to/export/posts_categories.csv'
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
Related Posts:
- How do I find which articles are missing a featured image in The WordPress database?
- Multiples Empty Posts were created and cannot delete them
- Extracting post categories
- How to Assign / Move all Deleted post to a category
- Migrate posts from category and sub-category via SQL
- Display post number by category
- SQL Bulk Move old posts by one author to another category
- exclude particular category in api
- Bulk find & replace on WordPress posts/pages (minus image paths)
- Is there a way to save different data when USER interacts with the same POST?
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- How to run select query of post with category and tags?
- Surrogate ID for posts, is there an alternative field in the posts table?
- How to make category for word post_content
- Change permalinks in posts via SQL
- How to get the number of posts in a selected category?
- Export WordPress Posts and Meta Information in CSV format
- Show related posts by category but ignore one category
- Add custom field to category of custom post type
- Can I hide a specific post from latest posts page?
- How to show post(excerpt) from specific category on wp page?
- get posts and postmetas in assoc array
- Insert posts in two tables
- WordPress – Admin Manage Posts – Multiple Filters by Parent Category
- Custom Theme Want To Remove One Category From All Displays
- Instead of submiting an entire post, is there any way to submit a lite-post or a simple message?
- Divide Loop Into Days & Categories
- Different template for posts of all subcategories of category
- How do I render all posts of the same category in same layout?
- Mark menu item as current-menu-item for category
- How to set up multiple taxonomies for groups of posts
- How to display category from recent posts?
- Can I divide the pages into categories?
- Duplicate posts and change category
- Category Foreach keeps looping?
- display a random post thumbnail from a random category
- Post page to display specific category
- how to show single post in a custom template
- wp_posts table: safely remove unused columns to save database storage
- Excluding posts not working
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- Remove current category from post but display all others
- How do I show posts from another wordpress installation?
- Latest posts by category — how to exclude current post?
- How do I include the category next to the title of a post?
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- Posts Missing in Dashboard after update
- How to get post with slug and exclude categories
- Retrieving posts by their date and category
- Are post, page and category IDs unique to each other?
- Static pages not working
- WordPress displays post on subcategory only
- Update field in database for users
- Remove Featured Image from posts in specific category?
- Get timestamp of latest post in C#
- Categories Listing and Highlighting current category item
- Display hierarchical categories/sub-categories for a single post only
- Is it possible to modify posts table to only read for more recent ones?
- Post in bulk based on category template
- Menu Items disappearing/being empty on save or post edit
- Author post count in category
- How to setup default value of post_id
- Reusing old post IDs
- Trigger on DB make problem on wordpress?
- WordPress MySQL Search and replace with wildcard?
- Why do I have categories with duplicate slugs?
- Using a meta_value or postdate to to query and orderby
- Automatic Table of contents with categories and posts
- How to create REST Based JSON API(how to modify the code below)?
- Is it possible to remove actual post pages in wordpress but keep them in categories
- Need help with hiding an image within a post in a category
- WordPress not showing recent posts
- How to get post count including nested categories
- How to filter out post from a category not its subcategory in wordpress dashboard
- Export Posts with specific custom fields by sql
- How can I display a specific number of post in a category via a url
- how to chang preview of list of articles of one category?
- Can’t create posts with WP DB Abstraction Plugin
- Post of a specific category – not to be seen in paging previous/next post
- How to show main category related to that post
- Display selected category on post page
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- Sort post by category using HTML Select tag
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to use in_category?
- About number of posts in selected category
- Use radio buttons & checkboxes for post categories
- List posts that are in the same category as the current post title
- Category page shows “No Posts” but I do have two assigned
- Exclude a ‘portfolio’ custom category?
- Is there a maximum amount of pages for a multi-page post?
- ‘get_previous_post’ in same category returning (!empty) when no previous post in category exists
- excerpt in template for specific page
- Only show posts belonging to multiple cateogries at same time
- Wrap posts from a category in HTML
- What effect can a large wp_post table have on overall site performance?
- I have a blog and want to prompt the user to select a category they like and have that select a random blog post
- How to remove category and other tags from posts page
- Get the category of post from which category page it have been clicked