Remove [gallery] shortcode altogether

The short code is actually entered into then page or post content so disabling the short code processing prevents the gallery short code from being replaced with the gallery images but it doesn’t affect the post content.

The best solution is to add a new short code handler after removing the default gallery handles. Another less desirable approach would be to remove the short code tag from all posts and pages.

Short code replacement would look something like this:

function no_gallery($atts) {
    return "";
}
add_shortcode('gallery', 'no_gallery');

Leave a Comment