E_WARNING: ltrim() expects parameter 1 to be string, object given in wp-includes/formatting.php:4494
Source: GET https://example.org/?pattern-categories=1&s=the
get_term_link() can return a WP_Error when the input is invalid, this is then passed to esc_url().
This is a slightly hacky workaround by checking that get_queried_object() returns something before venturing into the taxonomy branch.
Technically, it would probably be better to validate that get_term_link() return s a term, and that get_queried_object() return a WP_Term though.. so perhaps this could be && ( get_queried_object() instanceof \WP_Term )?
get_term_link() can return a WP_Error when the input is invalid, this is then passed to
esc_url()
.This is a slightly hacky workaround by checking that
get_queried_object()
returns something before venturing into the taxonomy branch. Technically, it would probably be better to validate thatget_term_link()
return s a term, and thatget_queried_object()
return a WP_Term though.. so perhaps this could be&& ( get_queried_object() instanceof \WP_Term )
?