Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The codex has this to say on wp_delete_post.

When the post and page goes, everything that is tied to it is deleted also. This includes comments, post meta fields, and terms associated with the post.

Which kind of suggests that if a post that had the tags a,b,c attached to it gets deleted, then, all the a,b and the c tags are also deleted from the wp_terms, and wp_term_taxonomies tables even if those tags were to be associated with some other living posts!* - which I doubt is the case. Why would WP API delete the terms that are working for some other posts?

share|improve this question
2  
You are aware that everybody can edit the Codex? I just did that. –  toscho May 28 '12 at 2:26

2 Answers 2

The relationship between the term and the post is deleted, not the term itself. On front-end the query for a term with no associated posts will result in a 404 tough. But if you go to the term list in back-end you still can see term with a post count of 0.

enter image description here

Always keep in mind that the Codex is a community project: Everybody can improve it, everybody can make it worse. Read it like Wikipedia as a start for your own research, not as the end.

share|improve this answer
    
Now it reads much better. ` This includes comments, post meta fields, and relationships between the post and taxonomy terms.`. I knew that it's open for edit nevertheless it's one of the best docs out there. When I see something not right, I wanted to point out. That's all. –  Average Joe May 28 '12 at 7:42

Everything that is a field on the post, specific to that post only is deleted. This means custom fields as well.

Tags, Categories and Media will not be deleted, as they are not actually part of the post. The post simply uses Tags, Categories and Media which are saved in different tables on the database.

share|improve this answer
    
It's still ambiguous cause it clearly says This includes comments, post meta fields, and terms associated with the post. Are you saying that if a post has the tag A and the tag A has not been associated with any other post and you are deleting the post, your tag A is also going down the drain with the post? –  Average Joe May 28 '12 at 0:57
    
No. Tags, Categories and Media will not be deleted, as they are not actually part of the post. Tags, Categories and Media are saved in different tables on the database. –  Travis Pflanz May 28 '12 at 1:15
    
So the bottom line is, codex is incorrect in the quoted sentence above. Agree? –  Average Joe May 28 '12 at 1:28
    
Just try it and see what happens... Make a single post, add an image, create a new category for it and a tag that is only associated with it. 2 minutes tops to test the theory. –  Travis Pflanz May 28 '12 at 1:37
    
Tested the theory. Unfortunately, the tag that was associated with the post was deleted as well. This results me to give 2 bad points to WordPress. 1st for to deleting the tag along with the post. and 2nd for the poor sentence on the codex. –  Average Joe May 28 '12 at 2:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.