How to use Oriented Object concept in add_filter or add_action with priority and number of parameters?

This is possible without additional parameters:

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

With parameters this is possible? How to?

1 Answer
1

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 Reply

Your email address will not be published. Required fields are marked *