wordpress image with caption shortcode replace
<p>I'am recently updated my old (3.0.1 version) wordpress blog witch have many posts with images inside. Also my blog have a script that finds all images in page content and replace them with image carousel. All works ok with old posts, but when I create a new post, carousel don't work. I noticed that the new wordpress version of the code is displayed in another way. On this carousel my script output does not work.</p>

<p>Is there a way to make so that shortcode is not changed. Such as a was in the old version.</p>

<p>old wordpress version shortcode:</p>

<pre><code>[caption id="attachment_27534" align="alignnone" width="450" caption="Caption text"]&lt;a href="image.jpg"&gt;&lt;img class="size-full wp-image-27534" title="" src="gailius.jpg" alt="" width="450" height="370" /&gt;&lt;/a&gt;[/caption]
</code></pre>

<p>new version changed this shortcode to </p>

<pre><code>[caption id="attachment_27534" align="alignnone" width="450"]&lt;a href="image.jpg"&gt;&lt;img class="size-full wp-image-27534" title="" src="image.jpg" alt="" width="450" height="370" /&gt;&lt;/a&gt;Caption text[/caption]
</code></pre>

<p><strong>EDIT:</strong></p>

<p>I found function that generate shortcode</p>

<pre><code>function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {

    if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
        return $html;

    $id = ( 0 &lt; (int) $id ) ? 'attachment_' . $id : '';

    if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) )
        return $html;

    $width = $matches[1];

    $caption = str_replace( array("\r\n", "\r"), "\n", $caption);
    $caption = preg_replace_callback( '/&lt;[a-zA-Z0-9]+(?: [^&lt;&gt;]+&gt;)*/', '_cleanup_image_add_caption', $caption );

    // Convert any remaining line breaks to &lt;br&gt;.
    $caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '&lt;br /&gt;', $caption );

    $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
    if ( empty($align) )
        $align = 'none';

    $shcode = '[caption id="' . $id . '" align="align' . $align . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';

    return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
}
</code></pre>

<p>how i can modify this part from my functions.php?</p>

<pre><code>$shcode = '[caption id="' . $id . '" align="align' . $align . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';
</code></pre>

<p>i am replaced all that function </p>

<pre><code>add_filter( 'image_add_caption', 'my_image_add_caption');

function my_image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
</code></pre>

<p>but nothing changed</p>