The PHP echo
language construct that outputs the parameters passed. You don’t want to do that in the middle of str_replace
. To replace $term->name with an empty string, use:
$wptitle = str_replace( $term->name, '', $wptitle );
Then when you want to print it, use:
echo $wptitle;