Get item of arrays in variable

Viewed 18

I need to get the term_id of the WP_term arrays that I get here. I get the themes arrays of the current post like this:

$themes = get_the_terms(get_post(),TAXONOMY_THEME);

Output is:

0 => WP_Term {#2262 ▼
    +term_id: 22
    +name: "Health"
    +slug: "health"
    +term_group: 0
    +term_taxonomy_id: 22
    +taxonomy: "theme"
    +description: ""
    +parent: 6
    +count: 14
    +filter: "raw"

1 => WP_Term {#2263 ▼
    +term_id: 27
    +name: "Women"
    +slug: "women"
    +term_group: 0
    +term_taxonomy_id: 27
    +taxonomy: "theme"
    +description: ""
    +parent: 6
    +count: 55
    +filter: "raw"

I want get the 'term_id' in a variable like '$themes_id', so I can filter to show only posts that have the same taxonomy.

How do I get this?

0 Answers
Related