filters - How to stop echoing gallery inside content?

admin2025-06-04  1

I want to completely stop echoing gallery inside the_content() because I am showing it in different position outside content as per design (with a help of get_post_gallery_images()). It is a custom theme from scratch, there are almost no plugins yet installed, I have tried it with this, but it does nothing.

 add_filter('post_gallery', '__return_false', 999);

This only works partially, if I return empty string it still shows gallery, but if I return some string it shows that instead.

add_filter('post_gallery', 'test', 999999);
function test() {
    return ''; // Shows gallery
    return 'asdfasdf'; // Doesn't show gallery but outputs this string
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749017212a315652.html

最新回复(0)