+ Reply to Thread
Results 1 to 5 of 5

Thread: Using Shortcodes

  1. #1
    Jeffro's Avatar
    Jeffro is offline WPTavern Forum Admin
    Join Date
    Jan 2009
    Location
    Ohio
    Posts
    2,107

    Icon5 Using Shortcodes

    I was wondering what the benefits and perils are of using shortcodes in your content. For instance, if you use shortcodes in WordPress like [youtube] and that displays a YouTube video in the blog post and you decide to migrate over to another platform, isn't it possible that all posts with the shortcode will not display the video but just the text [youtube] ? Are those who use shortcodes really short changing themselves?

    I've always used the embed code from video sites since I know that code is platform agnostic and will work if I transfer content. Furthermore, why do people use shortcodes anyways?

  2. #2
    Ryan's Avatar
    Ryan is online now WPTavern Forum Moderator
    Join Date
    Jan 2009
    Location
    New Zealand
    Posts
    2,418

    Default

    I always try to avoid shortcodes for this reason. It would make changing platforms a lot more complicated. The one exception I make is for galleries, I don't see any other way convenient way to do galleries but via shortcodes.

  3. #3
    davecoveney is offline Tavern Regular
    Join Date
    Jan 2009
    Posts
    210

    Default

    It would be quite easy to do a regex based shortcode search and replace (or remove!) on a DB using the utility I wrote: http://www.davesgonemental.com/mysql...erialized-php/

  4. #4
    Otto's Avatar
    Otto is offline Trac Master
    Join Date
    Apr 2009
    Location
    Memphis, TN
    Posts
    770

    Default

    Quote Originally Posted by Jeffro View Post
    I was wondering what the benefits and perils are of using shortcodes in your content. For instance, if you use shortcodes in WordPress like [youtube] and that displays a YouTube video in the blog post and you decide to migrate over to another platform, isn't it possible that all posts with the shortcode will not display the video but just the text [youtube] ? Are those who use shortcodes really short changing themselves?

    I've always used the embed code from video sites since I know that code is platform agnostic and will work if I transfer content. Furthermore, why do people use shortcodes anyways?
    You are correct for the most part. However, in the particular case of the youtube code, YouTube itself uses that code when you use their post-to-blog feature, meaning most platforms support it.

  5. #5
    joetek's Avatar
    joetek is offline Hello World
    Join Date
    Feb 2009
    Location
    Toronto, Ontario
    Posts
    58

    Default

    Furthermore, why do people use shortcodes anyways?
    The shortcodes are primarily a safe way of embedding videos that gets around kses filtering. By default, only Administrators and Editors have unfiltered_html capability, so your authors can still embed using shortcodes.

    The lower levels are filtered using kses for security reasons:
    kses is an HTML/XHTML filter written in PHP. It removes all unwanted HTML elements and attributes, and it also does several checks on attribute values. kses can be used to avoid Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks.
    You can probably trust embed codes from the big sites like Youtube, but any site could display a box and tell you to copy/paste something into your blog, and you have no idea what it does. I've seen embed codes that do the above, or throw in ads or add links into your content. Nasty stuff.
    Joe Taiabjee
    work: b5media.com - blog: joetek.ca - twitter: @joetek

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts