WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Wp-Thumbie] Caption shortcode shows up in description (SOLUTION)

[Resolved] [Plugin: Wp-Thumbie] Caption shortcode shows up in description (SOLUTION)

  • WP-Thumbie is a great plugin. I noticed it didn’t strip [caption] shortcode, so when you have an image at the beginning of your post it will show up in related posts description, pretty ugly. I’m not code, but I spent some time and figured out how to get rid of it. Thought I share in case someone else needs it.

    Look for wp-thumbie.php in the plugin’s directory. Now, look for this line:
    $post_text = wp_trim_excerpt($post_text); // Get Post Ecerpt
    Once you find it, you will need to paste this new line right after the one you just found:
    $post_text = preg_replace("/\[caption[^>]+\[\/caption\]/i", "", $post_text);
    This basically replaces [caption] with nothing. So, once you done this is what it should look like:

    $post_text = wp_trim_excerpt($post_text); // Get Post Ecerpt
    			$post_text = preg_replace("/\[caption[^>]+\[\/caption\]/i", "", $post_text);

    It should work right away =)

    Hope this helps you out.

Viewing 1 replies (of 1 total)
  • Hi 🙂

    This worked, excellent help, I was looking for this info long time..

    Now my code looks like this and working fine 🙂

    $post_text = wp_trim_excerpt($post_text); // Get Post Ecerpt
    $post_text = preg_replace(“/\[caption[^>]+\[\/caption\]/i”, “”, $post_text);
    $post_text = truncate($post_text,$crp_settings[post_text_char]); // Get Post Excerpt
    }
    $image = “”; // Null Variable to verify for no impage found case

    🙂
    Cheers mate

    SiRu

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] [Plugin: Wp-Thumbie] Caption shortcode shows up in description (SOLUTION)’ is closed to new replies.