disqus / disqus-wordpress-plugin

WordPress plugin for Disqus (Latest version)
https://disqus.com/
34 stars 25 forks source link

dsq_can_load filter does not support multiple callbacks #74

Open aaemnnosttv opened 5 years ago

aaemnnosttv commented 5 years ago

Currently, the dsq_can_load does not support multiple callbacks on it as the $script_name will be lost with the first callback that returns anything other that $script_name.

https://github.com/disqus/disqus-wordpress-plugin/blob/2df9eb93e7eadcb173e8c46bedd107a1f88a2e03/disqus/public/class-disqus-public.php#L258-L261

In order to ensure $script_name is available to all callbacks, it must be passed as a secondary parameter and use the first as the default return value.

E.g.

apply_filters( 'dsq_can_load', true, $script_name )

Unfortunately, this would be a breaking change to the way it is currently.

Is this something the maintainers are aware of?