[wp-trac] [WordPress Trac] #15008: Deleting a category can orphan posts from the term_relationships table

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 1 20:54:18 UTC 2010


#15008: Deleting a category can orphan posts from the term_relationships table
--------------------------+-------------------------------------------------
 Reporter:  blepoxp       |       Owner:  blepoxp             
     Type:  defect (bug)  |      Status:  new                 
 Priority:  normal        |   Milestone:  3.1                 
Component:  Taxonomy      |     Version:  3.0                 
 Severity:  normal        |    Keywords:  has-patch regression
--------------------------+-------------------------------------------------
Description changed by scribu:

Old description:

> Steps to reproduce:
> 1) Create a new category 2) Place a post in only that category 3) Delete
> that category 4) Observe that post no longer exists in term_relationship
> table (also causes posts to not appear in edit-posts list when filtered
> for 'uncategorized').
>
> Cause of problem:
> Direct calls to wp_delete_term() bypass logic and args previously
> populated in wp_delete_category().
>
> Possible solutions:
> Add logic from wp_delete_category() above each call for wp_delete_term
> and pass the args directly to wp_delete_term or conditionally check for
> taxonomy type and pass to wp_delete_category (a wrap for wp_delete_term)
> to pick up needed logic.
>
> The attached diff takes approach two and passes to wp_delete_category if
> 'category' == $taxonomy

New description:

 Steps to reproduce:

 1) Create a new category

 2) Place a post in only that category

 3) Delete that category

 4) Observe that post no longer exists in term_relationship table (also
 causes posts to not appear in edit-posts list when filtered for
 'uncategorized').

 Cause of problem:
 Direct calls to wp_delete_term() bypass logic and args previously
 populated in wp_delete_category().

 Possible solutions:
 Add logic from wp_delete_category() above each call for wp_delete_term and
 pass the args directly to wp_delete_term or conditionally check for
 taxonomy type and pass to wp_delete_category (a wrap for wp_delete_term)
 to pick up needed logic.

 The attached diff takes approach two and passes to wp_delete_category if
 'category' == $taxonomy

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15008#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list