add_filter OO with parameters

It’s done the same way you would do in procedural, you need to provide the priority and the number of parameters

so you would have;

add_filter('wp_get_attachment_image_src', array($this, 'useCDN'), 10, 3);

to pass 3 additional parameters to the filter

Leave a Comment