Firstly, this isn’t a WordPress error. It’s a PHP error. WordPress is not going to return type errors. That all happens and the language level. If you used the same values outside of WordPress you’d get the same error.
Regarding your specific issue, keep in mind that get_terms()
will return a WP_Error
object if the taxonomy is invalid or if your code is run before the taxonomy is registered. That’s most likely what’s happening here.
Related Posts:
- Tax query with multiple terms in pre_get_posts
- What is ‘term_group’ for ‘order_by’ in get_terms()?
- Order get_terms by term meta
- Get parent id by term id
- When to / not to use wp_get_post_terms vs get_the_terms?
- Why does WordPress combine a term with the same name in the wp_terms table?
- wp_list_categories: order by term order?
- Child terms from multiple parents?
- Exclude Child Terms From Parent Posts
- same taxonomy for several post types: how to hide empty in a specific post type?
- How to sort terms with diacritical signs?
- get_terms(); show private posts when logged in
- Get category ID after wp_insert_term
- How do I access a single term from a post?
- get_post_terms not working as expected
- WP_insert_term how to insert multiple values as taxonomny term?
- has_term() does not return when term is assigned post?
- get_terms() but with additional dimensions?
- Wp set post terms not work
- get_terms only show term if there is a post using it
- Get the Term List – Ordering
- Reduce / optimize calling of wp_get_object_terms() when generating permalinks
- How to trace/fix false $term->count, rogue term relationships?
- How to order and count get_terms by specific post type?
- Outputting an array of term meta values in a custom WooCommerce tab?
- Get those terms with a specific meta key value
- get_term_by “name” not working with & in name
- I want to loop through Woocommerce Product Catogories and show them in dropdown
- setting taxonomy term to bulk posts using ids
- Do I have to set parent when set post term?
- Modify automatically generation of slug when term is created
- Display custom taxonomy on single post
- Does get_terms() use any sort of caching on its query?
- 404 on term taxonomy archive pagination only with some terms
- Clone Terms of one taxonomy to another
- Get random out from get_terms()
- Conditional based on number of specific custom taxonomy terms in archive.php
- Categories order with get_terms_args not working in 4.7
- Sticky posts per category
- Faceted search with WP-API data
- Show List of Terms (not posts) that have been Recently Updated?
- When using the get_terms and trying to order the terms using the ‘order’ and/or ‘orderby’ does not work
- Query to get term id using post id?
- Conditional Statement with Multiple Terms?
- How to get a post’s associated taxonomies and terms in wp api v2
- wp_set_post_terms is assigning only the last of several terms to a post
- Get all terms linked to a post and include those who not connected from get_terms and sort
- How to force acceptance of site terms on first login?
- Add HTML to Term Description
- single_term_title() running before get_the_title() [closed]
- Get terms within a custom taxonomy
- How to get terms of not only the current cat but also of all its children
- Query posts using custom taxonomy and selected terms
- Ordering taxonomy output in this function
- How to get the $meta_type given the $object_id
- $args for get_terms() to return ORDER BY FIELDS
- Matching slug terms from one array to those in array of WP_Term objects to output term names
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- How to create a array that contains all of the children slugs of a specific parent category
- Getting terms to have space between them
- Custom term templates
- INSERTING Data into table with placeholders
- Removing a taxonomy term
- Taxonomy Drop Down with hierarchical view using $terms
- How to check if a term is parent to another?
- Create Terms on taxonomy by text field
- How to order a taxonomy’s terms numerically, from lowest to highest using get_terms
- Customizing the wordpress tag-cloud output
- get_terms() delivers wrong count with custom taxonomy childs on custom post type
- Why does term get inserted twice when using dynamic slug?
- WP Query by 4 different taxonomies
- wp_set_object_terms() to update a post taxonomy value
- Order get_terms by multiple values
- Get All Taxonomy Terms From Get_terms Array With Specific Array Key
- Confused by get_the_terms to use in a new wp_query
- get_terms for all custom taxonomies shows invalid taxonomy error
- Change the last separator in the_terms
- How to show only tagged CPT categories / taxonomies for a custom post type?
- Is there any WordPress way to get all categories for some selected posts?
- Order terms by creation date
- Unable to retrieve any child terms using get_terms
- Importing custom DB table entries as posts with Categories
- How to get several fields from wp_query?
- list of tags overlay
- Getting Term_id – Taxonomy Metadata plugin
- store an array of all the terms existing
- Order posts with custom taxonomy array
- Get only last child category link of products
- Get Parent Custom Taxonomy Term and Color Div background
- taxonomy terms array not working
- get_the_term_list() display in ul li and remove tag
- Function to delete a term when a custom post with the same slug is trashed
- Custom field drop down to set the term of the post when published
- Create heirachy of post terms from array & assign post to terms
- How we retrieve the ‘tags’ and ‘attachment’ of the custom post which is created by wp_insert_post();
- Relate term to term?
- How can I filter get_terms with post meta
- How to get tags only with custom meta field and display them randomly?
- Unable to import term_meta in wordpress using wp_cron
- Woo – Change order status by category [closed]