Add filter is not intended to replace fully the existing code, but rather to append it. In the case of post_gallery
, if you return ANYTHING but ''
, it will not do ANY of the default action. If you look on line 767 of /wp-includes/media.php
, you can see where the hook is applied and work around that. Depending on how much you want to do, gallery_style
can be used to just add CSS to the default…if you want to do more than that, you’ll have to write an entirely new output.