I was searching differences between term_id
and term_taxonomy_id
. I understood that term_id
is simply single term id and term_taxonomy_id
is unique id for term_id+taxonomy
group because we may have same term_name
and term_slug
in different taxonomies and wp gives them same term_id
.
But when I added similar terms(same term_name
and term_slug
) in different taxonomies, they got different term_ids
, so why I got different term_ids
if they should be same or if they should not be identical then what is purpose of term_taxonomy_id
?
I’d like to reset my IDs somehow but wordpress keeps remembering them. After I delete all my posts, I would expect my new first post to have the ID 1. But it is ID 14 let’s say, so it continues from where I left off even though I deleted the old posts.
The same goes to categories. I made 10 categories, and deleted them all. Now the next one I make will have the term_id 12. Why not 2? Where can I reset the count?
Any ideas?
Thanks!
Basher
$args['category__and'] = $my_array;
However, it was producing inaccurate results. So, I did some debugging and have printed out my SQL. Here’s an example of what’s happening.
Desired categories = 157 and 141
In the SQL, this is what I see:
WHERE term_taxonomy_id IN (140,156)
How bizarre is this? If I change the selected categories, it always actually uses the category minus 1. I’ve printed out my array right before, to make sure I’m not actually giving it the wrong numbers… but the array is fine:
Array ( [0] => 157 [1] => 141 )
Is this a bug with “category__and”? Am I misunderstanding how this should work? Any help would be appreciated.
Thanks!
]]>Here is the relation:
-In the first table (term_taxonomy) I need to select a particular item in the “description” area and its related “term_taxonomy_ID” found along the same row.
-Then I move to table 2 (“term_relationships”), here I use the “term_taxonomy_ID” I found – I need to look along the row and get the corresponding “object_ID”
-On to table 3 (posts) I need to use the “object_ID” I got from the last table. Its the same as the “ID” of the post i’m after. Once I have found the post via ID I need everything from that row – i’ll need to use the content, title etc.
So, from what I have seen other people doing I think this is possible if I use an “inner-join” to link the tables together?
One more thing, this query will need to return multiple posts. they all start with the same description like step 1, but there will be a few posts to return.
Please, educate me on SQL. I hope its do-able!
]]>I would like to have something like this :
<select>
<option value=”{term_taxonomy_id}”>Category WP 1</option>
<option value=”{term_taxonomy_id}”>Category WP 2</option>
<option value=”{term_taxonomy_id}”>Category WP 3</option>
<option value=”{term_taxonomy_id}”>…</option>
</select>
What is the MySQL Request in order to have all my categories in a select box ?
Thank you and excuse my poor english (i’m a french guy) !
]]>