I think you’re missing the number of callback input arguments, so try this one instead:
add_filter( 'wp_get_attachment_url','mfeu_filter_attachment_url', 10, 2 );
| |
Priority _____| |
Number of arguments ________|
The default is 10, 1
, so you’re currently only passing on the $url
and not the second $post_id
argument.