I am not good at SQL but I believe this SQL query will do the job for you.
UPDATE wp_posts
SET post_status="publish"
WHERE post_type="product" AND post_status="trash";
Please remember to change WP database prefix if it is not default wp
.
Related Posts:
- How to display SQL query that ran in query?
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- wpdb get posts by taxonomy SQL
- Multipart/formatted MySQL query problem
- Custom query filter not working on woocommerce category page
- how to retrieve specific product attribute value in an sql query?
- Show recent products first but “sold out last” in query
- WordPress creating excessive joins on meta_query with search
- cron job to auto delete posts of a specific post type older than x days
- Are database queries created using WordPress filters protected from SQL injection?
- Get posts by category with pure SQL query
- Custom query to get terms from post ids
- Get the timout value of a saved transient?
- What’s wrong with my $wpdb prepare?
- Get stock by custom meta field on all Woocommerce variable products
- Query Strings and Woocommerce
- How do I see the mysql query generated by get_posts( $args )?
- sql select query in wordpress ‘page’ [closed]
- problem with sql query in wordpress plugin
- Attempt to improve WP search, can someone check my SQL query?
- wpdb query problem to access previous 3 days posts
- I can’t figure out what’s wrong with this statement. $wpdb->query update
- Custom Query – Based on user input
- how to insert missing tags into the posts through mySQL?
- Query Nickname rather than Display Name in custom Woocommerce plugin
- $wpdb->prepare affecting the query?
- WordPress SQL search, how to handle SQL Injection?
- exclude pingbacks from wordpress SQL query
- prepare function sql safe method
- WordPress SQL query to tag all posts containing a specific word on title
- Select column name dynamically mySQL Query
- How do I query for posts by custom meta and those that have been stickied?
- Change pure SQL database query to WordPress post query?
- Cannot get sql request from Query object?
- I want to get on those users their meta value are like “AGENT” .. but this query is not working
- Display data from phpMyAdmin with WordPress
- SQL to Query the db and return all posts and it’s metas
- SQL query to delete users with multiple meta keys and comments
- Nested select statements not working
- Speed up search query that searches in post meta?
- Category_in return empty
- Are there any best practices for creating a Like/Favourite feature in WordPress using custom MySQL tables and without any plugins?
- Fastest and most efficient SQL query to check if UID exists
- How to make MySQL search queries with quotes
- $wpdb query for price in custom field value
- Run an update query in a function
- How to display a specific category using a custom Query in WordPress?
- Slow query when joining wp_posts with a lookup-table?
- Wpdb generates too many queries
- learn to run wpdb class
- SQL Query : how copy all tags of post into their post content in wordpress by sql query
- Where can I find the SQL to get the most used information by wordpress database?
- Custom Query for wp_posts using wp_postmeta
- WooCommerce Total # orders [closed]
- 3 queries to update WordPress
- What SQL Query to do a simple find and replace
- How to Optimize WP site for millions of posts
- Get Terms by IDs with IDs order
- Query WooCommerce orders where meta data does not exist
- How many WordPress SQL Queries per page?
- Slow wp_enqueue_media()
- How to display lastest post date in the homepage?
- Slow meta_query with about 4 milion record on wp_postmeta
- WordPress Find Duplicate Post By Content
- WP Query Sort by meta value (date)
- mySQL query. ORDER BY meta_key
- Disable the MySQL query in the main query
- Strange string in console from wpdb query
- How can I get the query that would be run for the archive page?
- Query metas (and not : query posts by metas)
- Select query for a login
- I can ‘t display product images based on the label
- wpdb print all post meta
- Export Specific User data without plugin
- How to write: $wpdb->update having WHERE NOT value pair in the array
- wpdb COALESCE won’t work
- Custom SQL Query passing array to WHERE p.id
- Query does not return content
- Query posts dynamic date range
- Parse query filter in wordpress and relation
- mySQL queries are executed twice on wordpress website
- List WordPress Post and Related Attachments outside of a post page
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Problem on displaying the results on my query
- SQL query – get a featured image’s alt / alternative text
- Improve performance of slow query
- WordPress search in modified post title
- Customising the default wordpress search functionality
- WC Booking query bookings with date ranges
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Set posts per page for parent category and it’s all children
- Exclude sticky posts from query
- If more than 1 image show post link?
- How to query different categories on index?
- How to specify what kind of is_single post?
- Print data from wordpress sql query
- Can I create my own query in wordpress with traditional methods?
- How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- How to use a dynamic term id for the query block