Unable to retrieve any child terms using get_terms
For some reason I'm not able to retrieve any child terms for the carabana_cat
taxonomy. Here's what I've done so far:
$custom_terms = get_terms( 'carabana_Cat', array( 'hide_empty' => false, 'orderly' => 'description', 'child_of' => 28) );
What am I doing wrong here? There are lots of child terms for id=28
which aren't showing up.
For some reason I'm not able to retrieve any child terms for the carabana_cat
taxonomy. Here's what I've done so far:
$custom_terms = get_terms( 'carabana_Cat', array( 'hide_empty' => false, 'orderly' => 'description', 'child_of' => 28) );
What am I doing wrong here? There are lots of child terms for id=28
which aren't showing up.
2 Answers
Reset to default 0Try relying on the new WP_Term_Query() class, here's an example per your code:
// WP_Term_Query arguments
$args = array(
'taxonomy' => 'carabana_Cat',
'hide_empty' => false,
'orderby' => 'description',
'child_of' => 28)
);
// The Term Query
$term_query = new WP_Term_Query( $args );
Taxonomy names are case–sensitive:
d( taxonomy_exists( 'post_tag' ) ); // true
d( taxonomy_exists( 'post_Tag' ) ); // false
You seem to have mismatch between taxonomy name and your code.
PS also orderly
reather than orderby
typo.
最新文章
- Gmail SMTP relay with postfix - Stack Overflow
- python - How to define grammar for minimum 1 of foo and maximum 1 of bar - Stack Overflow
- react native - Handling loginlogout without user undefined errors - Stack Overflow
- How to Implement Smooth Pinch-to-Zoom Animation similar to Photos application (iphone) in Flutter? - Stack Overflow
- Adding Fields to Order API Call on WooCommerce - Stack Overflow
- I need help importing my global.css file in next.js - Stack Overflow
- java - Custome Recipe Parsing Error when developing mod with fabric in Minecraft 1.21.4 - Stack Overflow
- ios - CocoaPods could not find compatible versions for pod "FirebaseCore": - Stack Overflow
- stata - Fill in missing values by group for all the variables in the dataset - Stack Overflow
- Error installing pip packages due to error in launcher and wrong python version - Stack Overflow
- css - How to bring the curved tail behind the img - Stack Overflow
- sharepoint - How to copy site page from one site to another site using Power Automate? - Stack Overflow
- Symfony 7 - Autocomplete form field - Stack Overflow
- react native - How to convert location of each corner relative to the Camera Preview to the device view? - Stack Overflow
- innodb - How does MySQL handle lock queuing order for SELECT ... FOR UPDATE? - Stack Overflow
- swift - Infinite Update Loop with .onGeometryChange and Padding - Stack Overflow
- java - Android physical keyboard support for key press and hold - Stack Overflow