You’re not filtering anything, that’s what’s missing and what the error is complaining about. Filters accept an input value and return something.
$original_value="foo";
$filtered_value = apply_filters( 'wpd_filter_function', $original_value );
The function should then accept $original_value
as an argument and return
some value, which is what you’ll get in $filtered_value
.
What you have in your code would be more appropriate as an action:
function wpse203948_header_cart(){
echo 'something';
}
add_action( 'wpse203948_header_cart', 'wpse203948_header_cart' );
// applying it
do_action( 'wpse203948_header_cart' );