I don’t see any issue with the uninstall besides the fact that echo a string(this interpreted us failed) and using hardcode prefix.
Below code have been tested locally with the latest version of WordPress.
// Access the database via SQL
global $wpdb;
$wpdb->query( "DELETE FROM {$wpdb->prefix}posts WHERE post_type="acme_product"" );
$wpdb->query( "DELETE FROM {$wpdb->prefix}postmeta WHERE post_id NOT IN (SELECT ID FROM {$wpdb->prefix}posts)" );
$wpdb->query( "DELETE FROM {$wpdb->prefix}term_relationships WHERE object_id NOT IN (SELECT ID FROM {$wpdb->prefix}posts)" );
// echo "UNINSTALL DAMMIT!!";
Related Posts:
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- Best practice way to delete user meta data during plugin uninstall?
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- Does plugin uninstall always put WordPress back into original state?
- How can I delete options with register_uninstall_hook?
- Plugin uninstall: why run dbDelta after $wpdb->query($drop_sql)
- Is it possible to uninstall one plugin from within another plugin?
- How to check what plugins used to be on a WordPress installation?
- Global variables during plugin activation , deactivation and uninstall operarations
- UnInstallation of a Plugin from a developers perspective – The correct and clean method
- One of my plugins broke when I tried to update it, how do I safely uninstall it?
- uninstall.php file in Plugin to clean DB
- How to remove traces from widget during uninstallation
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- Custom message on plugin uninstall
- Does plugin’s uninstall.php file have access to the plugin ‘s object?
- Remove .htaccess portion upon plugin deactivation?
- Plugin retrieving results even after uninstallation
- Can my hooked uninstall class function access a global var declared in main plugin file?
- Can plugin2 uninstall plugin1 at the very beginning of plugin2’s installation?
- plugin uninstall function drop the tables, but shows errors on admin
- How Do I Uninstall a Current WordPress Theme and Install a Fresh Theme
- Uninstalling IntenseDebate
- How to delete Crisp Chat plugin completely?
- How to remove links generated by SEO-smart-links?
- Scripts don’t enqueue after removing plugin
- Turn Off Auto Update for Single Plugin
- Is it bad practice to create own table for a plugin?
- Why is “plugins_loaded” not called/fired?
- Any plugin out there that uses WP’s internal image uploader?
- Customizing subject in comment notification e-mails
- All shortcodes not working on custom theme
- How to pass parameters (data) from plugin PHP to React
- Is it possible to have screenshots in any other section rather than the screenshots section?
- How to create an edit media button for slideshow plugin?
- Change Permalinks Structure to a Sequential Number for Each Post?
- Dynamic HTML not displaying at respective place
- Should I global $wpdb outside of any of my plugin’s functions scope?
- Short code for Venues
- merging an array to an existing array using add_filter
- Is there a reliable way to keep track of how long a WordPress theme has been active?
- Change wording of admin menu item?
- Check if we’re viewing an event
- Show price with Geo IP location
- How to get 1 or 2 specific posts on top of my wordpress blog?
- How to find a run away wordpress plugin causing performance problems
- Getting value from dymanic text variable into Contact Form 7
- className not populating in custom block
- woocommerce payment gateway callback not firing [closed]
- How to export post 2 posts WordPress plugin data [closed]
- Trying to create a private area custom for each user where they upload images to a server [closed]
- html generated by theme exist but doesnt appear in browser
- dirname( __FILE__) returning wrong directory inside plugin
- How to execute code only on posts older than 2 weeks
- “Master” WordPress Multisite – Database Sync
- WP plugins for Product web catalog [closed]
- I need help locating a URL that is on my site map, but that I can’t find in my WordPress dashboard
- Localize plugin name
- Cannot get wpdb data (Error in a simple fuction) [closed]
- Timber – Twig post.content returns null can’t create ACF Gutenberg blocks
- How to create multiple users at once?
- Add estimated value for a post according to the number of words
- Remove timthumb.php from my custom theme
- Add type to enqueued script inside plugin
- Automatically download, install and activate plugins that my plugin depends, how?
- Error in pdf generating plugin using FPDF
- Asynchronous request in wordpress
- How to use apply_filters?
- Displaying data from another database
- Every time I de-activate a custom plugin, the site encounters a critical error
- How Can i import plugin option?
- How to override any plugin file in the child theme
- There has been a critical error on this website
- How to generate random codes that have to be entered to access a Mailchimp form?
- Adding discount functionality to the cart
- Changing the CSS with a plugin
- How do I stop plugins and themes from getting updated in a new plugin?
- How come W3TC is allowed to host premium code in the WordPress repo?
- Woocommerce functions in custom class, avoid errors
- Passing function into add_action always returns the first argument
- Remove dashboard links from wordpress
- Setting multiple videos for the video background
- saving checkboxes value in plugin admin
- plugin not hooking to my custom hook
- Remove Url Parameter WordPress
- Populate select option with JSON file
- Create post loop that displays pages by cat ID
- Enahanced search for edit.php and custom post type
- Modify a plugin’s content
- Proper way to trigger a MySQL query via link in a plugin
- Different plugins activated online and offline
- Find And Add Category to Posts
- featured image problem with custom post type
- Unable to show 4 products in a row
- How to resolve these findings from security audit
- Activate or deactivate the sliders in slider revolution
- Text Wrapping in WPDataTables
- how to show selected options drop down menu values in attributes field in after saving post.php
- Buffered output in chunks and shortcode – how do I achieve that?
- Transfer wordpress comments form on another post [closed]