There is only one default term in Wordpress, that is the term uncategorized
from the taxonomy category
. This term is created when Wordpress is first installed. This term's ID will always be 1
if it is not altered in any other way by some custom code from a custom theme or plugin.
Term ids, like post ids, are very reliable and does not change within a specific installation unless they are altered by their relevant update_*
functions like wp_update_term()
which is used to modify term field values of an already created term. Here the term id will change if the term_id
field is explicitely set to anything else outside the original term id. Also, if a term is deleted, and it is recreeated, the term id will also differ from the previous one.
Term ids, like post ids, will differ between different installs ( except for the term uncategorized
, and the "Hello World" post ) as ids are assigned numerically ascending order in the order the post or term is created. In one install, if a term with slug term
is created as the seventh term, it will have an id of 7
, on another install, if the same term was created tenth, it will have an id of 10
.
To get a term id is easy, go to the categories page ( or tag or custom taxonomy pages), go to the specific term and keep your mouse on the edit
link. In the bottom left there will be a grey block which will hold the term id amongs other info. You can also create an extra column in your backend taxonomy ( category, tag or custom taxonomy ) pages to display the term id. There are a couple of good tutorials about this subject. You can also do a var_dump()
of the the result from functions like get_terms()
to find the relevant info from a specific term
To conclude, term ids within a specific install should always be 99.999% reliable, a term id does not change, it stays the same unless it is altered by the user himself via custom SQL queries or a custom function capable of altering the term id field, a plugin or a theme using such functionalities or if a term is deleted and recreated