Hallo
Für mein Plugin, welches Bilder mit dem Picture Element "ausstatet" habe ich folgendes Problem mit der Core Function "img_caption_shortcode" von WP.
Diese entfernt das Picture Element, dies ist wirklich echt ein Problem. Meiner Meinung nacht sollte diese Funktion das picture element berücksichtigen. Was meint Ihr dazu? Eine Lösung gibts leider keine ausser eben diese Function zu ändern, was natürlich nicht gut wäre (updates etc.)
Der Code: wp-includes/media.php
PHP
function img_caption_shortcode( $attr, $content = null ) {
// New-style shortcode with the caption inside the shortcode with the link and image tags.
if ( ! isset( $attr['caption'] ) ) {
if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
}
} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
$attr['caption'] = wp_kses( $attr['caption'], 'post' );
}
Alles anzeigen