Support » Fixing WordPress » 2.5 doesn’t allow square brackets in HTML ‘rel’ tags

  • well then

    i use the rather wonderful shadowbox.js to display image galleries on my site at http://www.darrell-berry.com.

    in earlier versions, i could use shadowbox’s tagging syntax to set up galleries in posts and pages using snippets like this:

    [SNIP]

    <a rel="shadowbox[gallery]" href="http://farm3.static.flickr.com/XXX/2240341276_7963027872_b.jpg" title="Nuke Them All @ Images 2 February 2008">Full-Screen Gallery</a>

    [/SNIP]

    HOWEVER in 2.5, the [gallery] text seems to get stripped out between database and the HTML returned to the client — ie when i do View Source in my browser of a page including the above, it comes out as:

    <a rel="shadowbox" href="http://farm3.static.flickr.com/XXX/2240341276_7963027872_b.jpg" title="Nuke Them All @ Images 2 February 2008">Full-Screen Gallery</a>

    which breaks shadowbox (the [gallery] text is the bit which tags a bunch of images as being part of the same gallery!)

    i’m guessing that the stripping out is down to some enhanced version 2.5 sanitising/XSS blocking? If so, its blocking valid XHTML (shadowbox-enabled XHTML validates correctly, so stripping the brackets out is taking out a valid construct, as i read it, and hence a bug!)

    any thoughts?

    d

Viewing 6 replies - 1 through 6 (of 6 total)
  • WordPress 2.5 uses [gallery] as the shortcode for its own gallery functionality.

    The only workaround would be to disable WordPress’ gallery functions entirely. Add this to your theme’s functions.php to do that:
    remove_shortcode('gallery');

    Will shadowbox allow you to use rel=”shadowbox[gallery1]”? That seems like an easier thing to do.

    thanks guys — the ‘gallery’ tag for shadowbox is arbitrary, so i change that and it works… weird to run into a ‘namespace collision’ within 5 mins of upgrade… maybe as a matter of principle, all WP-related tags etc should start wp- (like much of the code does/did!) — much less likely IMHO to run into naming collisions with other tools if WP used wp-gallery, for example!

    anyways

    thanks!

    d

    This is a nice Idea! Even if theoretically this will not solve it until the end of days it might help a lot!

    But the other way round is true as well: [gallery] in rel is only a suggestion of shadowbox so it should be replaced with your gallery-name like [mygallery] or so.

    Why not shadowbox_gallery instead? It could collide with any CMS.

    I dunno wether you can use an _ inside the shadowbox gallery rel option. But as I wrote, this is true for the other way round as well, therefore for shadowbox as well.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘2.5 doesn’t allow square brackets in HTML ‘rel’ tags’ is closed to new replies.