php - Notice: Undefined property: WP_Error::$term_id -
hello facing problem .
notice: undefined property: wp_error::$term_id search.php on line 53
and here code.
if($category_name != "all") { $thiscat = get_category(get_query_var('cat'),false); if(isset($thiscat)){ $catsearchid = $thiscat->term_id; } } else { $catsearchid = '-1'; }
any body please? thanks
notice: undefined property: wp_error::$term_id search.php on line 53
this error clear, term_id property not part of $thiscat.
for solution,
do not pass second parameter in get_query_var()
function. optional parameter default empty.
Comments
Post a Comment