WordPress: the_content filter kills gallery shortcode

My the_content filter kills gallery shortcode and I dont know where the problem is…
I can add just blank the_content filter and gallery disappear from the content and there is just text. I am using the_content filter:

function test($data){
    echo $data;
}
add_filter('the_content', 'test');

Any suggestion how to fix it?

Related posts

Leave a Reply

2 comments

  1. You can just pass the modified content within the do_shortcode() to keep the short code functionality working after doing your stuff with the content.

    add_filter('the_content','your_function');
    function your_function($content)
    {   
        $content = get_the_content();
        $content = ;// Add your own stuff
        $content = do_shortcode($content);
    return $content;    
    }