<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Host Wiz &#187; WP SQL Queries</title>
	<atom:link href="http://www.thehostwiz.com/category/wordpress/wp-sql-queries/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thehostwiz.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 19 Jun 2010 03:03:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress &#8211; How to Query the Categories and not the Tags in Wordpress</title>
		<link>http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/</link>
		<comments>http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 17:02:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[WP SQL Queries]]></category>
		<category><![CDATA[mysql query]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wp_term_taxanomy]]></category>
		<category><![CDATA[{$table_prefix}term_taxonomy]]></category>

		<guid isPermaLink="false">http://www.thehostwiz.com/?p=11</guid>
		<description><![CDATA[Today I had found I had a problem with an old plugin that queried terms table for categories. It seemed after upgrading Wordpress to the latest version, I was getting all of the tags along with the categories. All I wanted was the categories. 
Well I found that the results of the terms table also [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had found I had a problem with an old plugin that queried terms table for categories. It seemed after upgrading Wordpress to the latest version, I was getting all of the tags along with the categories. All I wanted was the categories. </p>
<p>Well I found that the results of the terms table also included the tags(which were previously in the posts table. After some research I found that this change was implemented over a year ago. So much for me keeping up with the changes.</p>
<p>Well I had to figure out how Wordpress differenciates between tags and categories, This is were the term_taxonomy table comes into play. The ID of the category or term from the terms table is placed in the term_taxonomy table and gets identified with either category or post_tag in the taxonomy fieldof term_taxonomy.</p>
<pre class="brush:php">
$r = mysql_query("SELECT * FROM {$table_prefix}terms, {$table_prefix}term_taxonomy
WHERE {$table_prefix}terms.term_id = {$table_prefix}term_taxonomy.term_id
AND {$table_prefix}term_taxonomy.taxonomy = 'category'");
</pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;submitHeadline=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;title=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;title=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;title=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;bm_description=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;T=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;title=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;title=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress+@+http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/&amp;t=Wordpress+%26%238211%3B+How+to+Query+the+Categories+and+not+the+Tags+in+Wordpress" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.thehostwiz.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.thehostwiz.com/wordpress/wp-sql-queries/how-to-query-the-categories-in-and-not-the-tags-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
