#10821 closed defect (bug) (fixed)
Taxonomy problem with deleting posts
Reported by: | pavelevap | Owned by: | filosofo |
---|---|---|---|
Milestone: | 2.9 | Priority: | high |
Severity: | major | Version: | 2.8 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
When I delete post, there are also deleted its relations to tags, categories, custom fields etc. But relations to taxonomy persists. So I can see on taxonomy page that there is post with parzticular taxonomy term, but this post no longer exist. The same problem is with function wp_delete_post().
Attachments (2)
Change History (15)
#2
@
15 years ago
- Keywords reporter-feedback removed
- Severity changed from normal to major
- Version set to 2.8
Confirmed 2.8.4 leaves orphaned rows in the term_relationships table when the term_taxonomy_id value belongs to any custom taxonomy. For example, if I delete post ID 41, there are still some rows with object_id 41.
#3
@
15 years ago
- Keywords needs-patch added
See http://core.trac.wordpress.org/browser/trunk/wp-includes/post.php#L1189
/** @todo delete for pluggable post taxonomies too */ wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
#6
@
15 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
wp_delete_attachment() needs the same treatment.
Also get_object_taxonomies($post->post_type)
is better suited, as the function already handles posts/pages, and will handle custom post types this way.
#7
@
15 years ago
hit a slight issue with wp_delete_attachment... According to the Taxonomy system, category and post_tag do not get applied to Attachments, Yet, Categories get attached to ALL post types (ie. EVERY object in the posts table gets an attachment, Uncategorized if nothing specified)
As a result, i'm not sure what to do there, The proper thing would be to tell Taxonomy that the category tax applies to ALL objects, This however, has the disadvantage that, well, It doesnt apply to everything in practice.
So instead, I've just left wp_delete_attachment deleting category and post_tag anyway, and then a seperate call to delete custom tax's..
#8
@
15 years ago
Yet, Categories get attached to ALL post types (ie. EVERY object in the posts table gets an attachment, Uncategorized if nothing specified)
..And for that reason, wp_delete_post() should also specifically delete categories.. Not going to add a second patch for that, A commiter can merge that in..
#9
@
15 years ago
wp_delete_post() should also specifically delete categories..
Because it deleted custom post_type's which may have a category, or at least, an Uncategorized category.
#11
@
15 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
$postid is uninitialized. Do not pass go, do not collect $200 ;)
pavelevap, on which version of WordPress did you experience this problem?