Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

tpk on "term_exists parent zero"

$
0
0

Hi,

I have a term of category taxonomy called 'Foo' (id: 7) with parent 'Bar' (id: 5)
If I check the existence of term Foo with parent 0 via:

term_exists( 'Foo', 'category', 0 );

it returns me the Bar children (with id: 7) instead of 0 / NULL as expected.
That's because in wp-includes/taxonomy around line 1591 ( 3.8.1 ) there is:

if ( $parent > 0 ) {
        $where_fields[] = $parent;
        $else_where_fields[] = $parent;
        $where .= ' AND tt.parent = %d';
        $else_where .= ' AND tt.parent = %d';
}

I don't know if this is a bug or proper behaviour.


Viewing all articles
Browse latest Browse all 8245

Trending Articles