I need to return the ID within this function:
$ field = odin_get_term_meta (CATEGORY ID HERE, 'cattitle');
I tried with get_term_meta () and get_terms () and nothing. I guess it's pretty simple, I do not know where I'm going wrong.
I need to return the ID within this function:
$ field = odin_get_term_meta (CATEGORY ID HERE, 'cattitle');
I tried with get_term_meta () and get_terms () and nothing. I guess it's pretty simple, I do not know where I'm going wrong.
You can use get_term_by () with the data you have in the category.
Ex.:
// Retorna o objeto da categoria Animais Fofinhos
$categoria = get_term_by( 'slug', 'animais-fofinhos', 'cattitulo' );
The first parameter accepts slug
, name
, id
or term_taxonomy_id
.
e depois:
$field = odin_get_term_meta( $categoria->term_id, 'cattitulo' );