Bookmark and Share

wordpressA new feature introduced by WordPress 2.6 is the image caption which automatically adds under every picture in your blog a brief description of your choice. If you read well what I just wrote you should notice the term automatically. This mean that, by default, the aforementioned feature is always on and you don’t have any option to disable it. The code    [ caption ] and [ /caption ] which encloses the IMG, OBJECT or EMBED HTML elements will translate into <div> and </div> CSS attributes to position caption, accordingly.

Here is a brief example:

<a><img /></a>

If you don’t like the idea of having a caption text under your medias (image and videos), here is a little trick to disable and turn it off.

  1. Start your FTP client and gain access to your blog’s root.
  2. Look for this file located in public_html : wp-config.php or this file located in your theme’s folder (public_html/wp-content/themes/yourtheme): functions.php.
  3. Add this code wherever you want in the file: define(’CAPTIONS_OFF’, true);

This little trick will no longer be supported starting from WordPress 2.6.1. As a matter of fact the new WordPress version will have a caption disabling function support via plugin’s filter.

The new caption feature also introduces another important issue which webmasters might face in their themes after upgrading to the new WordPress version. As a matter of fact, WordPress 2.6 adds a DIV code to print the caption title under the picture or image, and to do that it uses a default auto alignment, color, font, and spacing. Because of this, webmasters could notice that the text around an image or a video may not be aligned properly or too close to the picture or video itself. To solve this issue here is a piece of code to add to the theme’s style.css file:

/* Captions */
div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;

.wp-caption {
border: 1px solid #ddd;
text-align: center;
background-color: #f3f3f3;
padding-top: 4px;
margin: 10px;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;

.wp-caption img {
margin: 0;
padding: 0;
border: 0 none;

.wp-caption p.wp-caption-text {
font-size: 11px;
line-height: 17px;
padding: 0 4px 5px;
margin: 0;
/* End captions */

If you wish to know and understand more about alignement issue, please take into account to visit these two WordPress forum’s topics click here and here.

Edit: Here is another couple of ways to disable the caption features in WP:

1) Add this to your theme’s functions.php file:
function no_caption($deprecated, $attr, $content) { return $content; };
add_filter(’img_caption_shortcode’, ‘no_caption’, 10, 3);

2) Alternatively, add this to your theme’s functions.php file:
define(‘CAPTIONS_OFF’, true);

3) Add this to your theme’s functions.php file: add_filter(‘disable_captions’, create_function(‘$a’,’return true;’));

Related Articles Latest Articles

6 Comments to “WordPress 2.6, its new caption feature and the text alignement issue”

  1. seguinsound.com/blog » Wordpress 2.6 Caption Alignment Fix Says:

    […] this!  There is some issues with the new “captions” feature for images.  I found a great fix here which I am simply reposting […]

  2. Another WordPress Post… | Biden PC's Quick Notes Says:

    […] but the captions looked horrible and off-center. So I found a post by Francesco that tells how to Center WordPress Captions. It works and looks […]

  3. Web Talk Says:

    Thanks mate and continue reading Web Talk! 🙂

  4. Download Free Software Says:

    Thank you. I appreciate that. I’ll put it in right now.

    Oh, and I’ll give you a link from one of my other blogs. =)


  5. Web Talk Says:

    Hello there,
    No it doesn’t matter where you put the piece of code inside the functions.php file. If you want you can add a brief comment right before it to know where it is located, or you can just add this code at the beginning of the file.

  6. Download Free Software Says:

    I’ve been battling (and losing) the issue of how to disable those stupid captions for days. I guess I just haven’t been googling the right thing. Thank you.

    Now I can start using the ALT text on my images. They looked stupid with the captions below it.

    Just 1 question… Does it matter where I put the code for:
    function no_caption($deprecated, $attr, $content) { return $content; };
    add_filter(’img_caption_shortcode’, ‘no_caption’, 10, 3);



Copyright © 2007-2017 | Sitemap | Privacy | Back To Top
Best screen resolution 1280x800 or higher.
Web Talk is best viewed in Firefox.