Opened 11 years ago
Closed 9 years ago
#28719 closed defect (bug) (worksforme)
Neither wp_delete_post or wp_delete_object_term_relationships deleting taxonomy relationships in uninstall.php when using custom post types and custom taxonomies.
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9.1 |
Component: | Database | Keywords: | reporter-feedback close |
Focuses: | Cc: |
Description
I have been working on an uninstall.php routine for a plugin using custom post types and custom taxonomies and noticed the wp_delete_post function is not removing rows from the term_relationships table. I tried using wp_delete_object_term_relationships but this failed to remove the rows as well.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hi jmds,
First of all, sorry you never received a response to this ticket.
Without seeing code, it's hard to see what the actual problem you've run into was, but I'll take a guess based on the most common reason.
When the plugins
uninstall.php
file is included, the plugin is not active, this means that any taxonomies and post_type's need to be registered uponuninstall.php
being called. Simply including the main plugin file is often not enough either, as theinit
action has already been run, so usually the function/method responsible for registering the taxonomy needs to be called directly fromuninstall.php
.Another way of looking at it, is that
uninstall.php
is designed to be self-contained, it's not supposed to rely upon the plugin setting up the environment, and including the plugin automatically directly during uninstall can often lead to bugs with plugins that don't expect to work like that.If this sounds like the issue you ran into, this ticket can be safely closed I believe.