Your MySQL table structure creates a reference and constraint relationship between your wp_product table and wp_posts. MySQL is doing exactly what you have instructed it to do. In this case, preventing you from deleting a record in wp_posts that is ‘related’ to records in your wp_product table.
In a nutshell, this is what foreign keys are supposed to do; maintain data integrity. Therefore you cannot delete a row in wp_posts while a corresponding/related record exists in wp_product.
I’d suggest taking a look at the MySQL documentation on Using FOREIGN KEY Constraints. Per your comments below I’d suggest looking at ‘Referential Actions’ to set the action to CASCADE.
Review the linked documentation to drill down to the specifics that match your requirements.
Related Posts:
- MySQL Query to Retrieve Category from wp_posts
- SQL Query for getting all posts in their latest revised state
- Search & Remove Specific Shortcode From All Posts
- Manually delete post from database
- How to force update all posts after import
- Query All users that has post
- Can’t publish new posts
- Manually removing revision post types
- Reset/Reorder posts ID in the MySQL wp_posts table
- How do I find which articles are missing a featured image in The WordPress database?
- Tags to Post-ID mysql query. Tag Search
- wp_insert_post – duration
- Get user categories with most posts in it
- MySql query to get posts with all meta and terms
- Custom order for Mysql array
- List authors with the last post title and order by last post date
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- Remove a shortcode from all WordPress posts
- Order posts alphabetically: how to set order=asc in mysql query?
- What do these phpMyAdmin errors mean on my WordPress databaes?
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- update image path with words starting uppercase to lowercase chars
- Queries take 120+ seconds on my large WordPress site
- Database hacked – random posts are modified
- Need to change all links in page content but not in post content
- Can’t update WordPress Page if post_content is Empty
- Restore woocommerce orders
- How to select particular month post from table and update the post status using MySQL?
- How do post IDs work in WordPress?
- Get author posts count after excluding a category
- get last post’s link with SQL query
- query for filtering published posts?
- MySQL: Possible to replace all of wp_posts.post_content(id#) via UPDATE + REPLACE + SELECT?
- Deleting post tags removes categories
- Return records between two meta datetimes saved as strings
- WP query taxonomy optimization
- MYSQL: Create SQL query to search for string and replace
- Query to fetch custom taxonomy along with post title
- Mysql update menu_order problem
- Bulk find & replace on WordPress posts/pages (minus image paths)
- WordPress MySQL Search and replace with wildcard?
- Add postmeta to all blog posts
- ‘posts’ table should not store the absolute image path
- Dev and prod on the same database- dev version active for IOS
- load post data into mysql
- SQL trigger failes with post_content
- Converting Posts to Pages
- How to change the publishing date of each posts?
- SQL query to remove first image in all posts
- Delete junk text from all the post using my sql command
- FIND and REPLACE wp_posts AND IGNORE custom post type mysql query
- How to create a post based on data in a table?
- If meta_key exists then don’t select this post?
- How to update wp_posts with just the returned comment count from wp_comments (SQL GROUP BY)
- How to manually delete post from database without causing conflicts?
- Force “Submit to review” when a post is updated
- What is the best / efficient way to get WordPress content by post id and why?
- Where can I find the code how wordpress parses a post?
- How to load post content on index page using ajax when post title in sidebar is clicked
- Custom Post Type Pagination Doesn’t Work in WordPress 3.4
- Get only modified posts
- Custom fields on a virtual page
- Are posts updated or built from revisions + autosaves?
- Adding footers to posts?
- Filter Custom Post Type by Category with Ajax
- Preserve term order per post in a non-hierarchical taxonomy
- Unautop / Sanitize content added to a post through a plugin
- WordPress programatically inserted post not showing in authors profile
- WP Remote Request not returning all of content via request
- Update all comments time to random dates?
- How can I get global $post to work for CPT and update user?
- How to copy posts from one site to another in real time (not multisite)
- Include sticky posts on the static page front page
- How can I setup a relationship using categories in WordPress?
- Editing 375 posts simultaneously? Maybe from the database?
- How Do I Get My Post Tags to Alphabetize?
- Changing default WP-Site creation date
- Delete post revisions only for a single post
- wp_set_object_terms NOT working on CPT, but wp_set_post_terms does
- Where to insert the other site image url for our wordpress post
- Get Users Post ID
- add_rewrite_rule and template redirect not working
- Automate post update for all posts?
- Allowing Users to Register Themselves and Post : Does WordPerss Handle these Problems?
- DEL media from the post but keep my featured image or post
- Set post title font size automatically according to number of words in post title
- Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )
- How to make an image appear as a thumbnail in the blog post?
- How can i take all ids from untrash_post action?
- Can I Paginate Post after every 25 tag?
- How to show posts ordered by random [duplicate]
- Query posts from newest category
- Trim excerpt to first paragraph
- Adding div to WordPress page content
- WordPress loop uses unmodified posts array, why?
- How to display custom content in post with category XXX
- Display only posts with comments
- how to show all type of author posts in author page (SOLVED)
- WordPress Page Column Problem [closed]