Timeline for Warning: Attempt to read property "term_id" on int - Woocommerce
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 14, 2022 at 11:33 | vote | accept | Naycom | ||
Aug 14, 2022 at 11:33 | answer | added | Davide Ladisa | timeline score: 1 | |
Aug 11, 2022 at 9:34 | review | Close votes | |||
Aug 26, 2022 at 3:07 | |||||
Aug 11, 2022 at 8:21 | history | edited | Naycom | CC BY-SA 4.0 |
added 2 characters in body
|
Aug 10, 2022 at 12:46 | comment | added | Sally CJ |
get_terms is a filter applied by get_terms() which doesn't always return an array, and even when it's an array, it's not always an array of objects. And in your case, the "term_id" on int in the error implied that the $terms was an array of term IDs instead of objects. So you can't simply use $term->term_id , because $term could be a term ID, name, etc. and is not necessarily an object.
|
|
Aug 10, 2022 at 11:29 | comment | added | Sanzeeb Aryal |
print $terms and see if everything is expected, likely it is not.
|
|
Aug 10, 2022 at 8:01 | history | asked | Naycom | CC BY-SA 4.0 |