WordPress.org

Forums

Can you remove captions from images? (6 posts)

  1. prathik
    Member
    Posted 6 years ago #

    When I upload an image using the new image uploaded, it asks for a caption which is also the alt text. After adding the caption a grey box surrounds the image with the same caption text. Is there anyway I can stop that from happening? But I do want the alt text to come so I can't keep the field empty

  2. klugefest
    Member
    Posted 6 years ago #

    I have the same problem. I've seen certain posts saying that they fixed it but I haven't been able to get rid of them yet. Does anybody have an answer for this?

    Tim

  3. Monika
    Member
    Posted 6 years ago #

    try this in the functions.php of your theme:

    function no_caption($deprecated, $attr, $content) { return $content; };
    add_filter('img_caption_shortcode', 'no_caption', 10, 3);
  4. curtismchale
    Member
    Posted 6 years ago #

    You can change the CSS that adds the caption style so that it sets the display to none. In the styles.css file it is the stuff with .caption at the beginning.

  5. Roger Coathup
    Member
    Posted 6 years ago #

    @Monika: I tried your fix, but it nows give me the following code when I try to update a post in my editor:

    function no_caption($deprecated, $attr, $content) { return $content; }; add_filter('img_caption_shortcode', 'no_caption', 10, 3);
    Warning: Cannot modify header information - headers already sent by (output started at /home/inspired/public_html/biggerboat/wp-content/themes/biggerboat/functions.php:2) in /home/inspired/public_html/biggerboat/wp-includes/pluggable.php on line 850

    Any thoughts? I'm on 2.7.1

    @Curtismchale: I'm always a little loathe to use 'display:none' lest Google thinks the site is attempting to 'keyword stuff'... am I being paranoid?

    Roger

  6. petersom3000
    Member
    Posted 6 years ago #

    This works:
    add_filter( 'disable_captions', create_function('$a', 'return true;') );

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags