SQL for listing all WordPress tags

When writing a post I sometimes find it difficult to choose what I should tag it with. I try reuse tags I already have to prevent a total mess, and sometimes I just don’t really remember what tags I have used so far. When writing a post in WordPress you can get a list of the most used ones, but once in a while I write a post on subject I haven’t written a lot about. So, instead of going to the Post Tags page and look through all the pages of tags, I decided to just connect to my blog database and run a query.

SELECT name, slug, description, COUNT FROM wp_terms
NATURAL JOIN wp_term_taxonomy
WHERE taxonomy="post_tag"

Lists all your tags, sorted by name ๐Ÿ™‚

  • Araรง Takip

    Are tags meant to be created for search engine optimization purposes or only to ease navigation?

    • Honestly, I have no idea ๐Ÿ˜› I’m guessing it’s just for organization and navigation. With WordPress you also get a feed per tag, so that you can subscribe to just posts with a certain tag. Search engines probably create their own tags somehow. As far as I know, there are no semantic way to mark tags as tags. But yeah… you’d have to ask the search engines about that, hehe.

      I honestly don’t really care much about SEO. Focus on creating good, clean, original and organized content instead and most search engines are smart enough to pick up on that.

  • Pingback: Wordpress – Sql to list tags « TechnoReaders.com()

  • Pingback: Wordpress – Sql to list tags | TechnoReaders.com()

  • Pingback: Walkabout - Tagged()