WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Your `warmHome_cutstr` function causes in the inline stylesheet of the gallery to be displayed. See gallery-post.jpg.[http://themes.trac.wordpress.org/attachment/ticket/4560/gallery-post.jpg][1] To solve this, you need to hook into the_content and remove the gallery shortcode. In functions.php:

    add_filter( 'the_content', 'warmHome_content_filter' );
    function warmHome_content_filter( $text )  {
        $text = strip_shortcodes( $text );
        return $text;

the following is my warmHome_cutstr function. how to correct it. i have added the above function. but don't know how to remove the gallery shortcode.

function warmHome_cutstr($string, $length) {
             $string =strip_tags($string);
         $strcut= '';
         if(strlen($string) > $length) {
        preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/", $string, $info);
         $j = 0;
        for($i=0; $i<count($info[0]); $i++) {

                $strcut .= $info[0][$i];

                $j = ord($info[0][$i]) > 127 ? $j + 2 : $j + 1;
                if ($j > $length - 3) {
                        return $strcut." ...";
        return join('', $info[0]);
                 } else {
                          return $string;
share|improve this question
up vote 3 down vote accepted

To remove the Gallery Short-code completely add this to your themes function.php file:

remove_shortcode('gallery', 'gallery_shortcode');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.