Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- MySQL Query to export all Woocommerce reviews to a CSV file which can then be imported into Site Reviews
- -- 1. Install the [Database Browser](https://wordpress.org/plugins/database-browser/) plugin
- -- 2. Go to the "Tools > Database Browser" page
- -- 3. Click the "Select table" button (it doesn’t matter which table is selected)
- -- 4. Copy the table prefix of your tables (for example, if the table is `wp_posts`, the prefix is the first part with the underscore `wp_`).
- -- 5. Click the "Edit query" button
- -- 6. Paste the SQL query, replacing every instance of `wp_` in the SQL query with your table prefix.
- -- 7. Click the "Run query" button
- -- 8. Click the "CSV" button to download the results
- SELECT
- c.comment_date as date,
- c.comment_date_gmt as date_gmt,
- cm.meta_value as rating,
- c.comment_content as content,
- c.comment_author as name,
- c.comment_author_email as email,
- c.comment_author_IP as ip_address,
- c.comment_approved as is_approved,
- c.comment_post_ID as assigned_posts,
- c.user_id as user_id
- FROM wp_comments AS c
- INNER JOIN wp_commentmeta AS cm ON c.comment_ID = cm.comment_id
- WHERE 1=1
- AND c.comment_type = 'review'
- AND cm.meta_key = 'rating'
- AND cm.meta_value IS NOT NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement