11 Comments

  1. chrismccoy

    i wonder how many plugins use the youtube shortcode, i assume a lot do.

    would be interested in the actual number


  2. I am against any form of a shortcode repository, it will be difficult to maintain, it has privacy issues and it is not necessary. Just introduce namespaces, like every decent programming language does to solve this kind of issues. Existing shortcodes do not have a namespace (yet) and new shortcodes can have one to prevent conflicts. A shortcode could be written like this, where namespace is optional.

    [namespace:shortcode]


  3. Here’s one: WordTube uses [media] while Media Tags uses [media-tags]. A clash between two plugins, even though the shortcodes are – to human eyes – different.

    Now I know (from asking) that it’s a WordPress issue, but it doesn’t help!

    A list of ‘claimed’ shortcodes would be good, but given the number of plugins that aren’t tested as compatible with recent versions of WP, there’s have to be a way of saying, for example, that any plugin not testedwith the latest version (or latest version minus a dot point or two) can be released for re-use. We’re at 3.2.1; should anything not tested with version 3.x be removed, or highlighted in some way?

    Gary


  4. I think the developers should start prepending the plugin name to the short code such that [youtube] becomes [mypluginYouTube] or [myplugin_youtube] or something similar and at the same time make it mandatory to build a UI to enter the same..
    Advanced users ca obviously remember the long name while casual users can use the UI


  5. @Marcel – A directory wouldn’t be difficult to maintain if it was automatically generated. Any plugin added to the repository would simply be scanned on upload/commit, and could be tagged in a directory, noting nothing more than shortcode name & plugin from which it’s from.

    I don’t see why this would be a privacy issue; plugins hosted on the WordPress repo are open source and browseable via Trac already, so having an auto-generated list based on them would reveal nothing that isn’t already available.

    If a standard way of declaring namespaces and so forth was devised, a directory for them would be useful too. (For instance, to prevent conflicts of localization namespaces, plugin option namespaces, and so forth.)

  6. Andreas Nurbo

    Perhaps shortcodes should have an optional prefix if there might be a clash. Another optional param on the register shortcode function. WordPress should be able to tell that the same shortcode has been registered twice and automatically activate prefix usage.
    It doesn’t have to be activated from the get go but the option should be there.


  7. Namespaces, like in other coding languages, is the solution, not more with more expenditure


  8. @Namith: automatic prefixes are not a good idea for groups of related plugins.

    @Rick: regarding privacy you maybe right, but automatically generating a directory will not work. For example:

    add_shortcode($plugin_name . '_' . shortcode_names[$i], shortcode_function[$i]);

    and a lot of other constructions will be missed.


  9. Mark Jaquith already admitted that by pointing out that his list was simple quoted shortcodes only. However, even more complex constructions could be noted in a section of the directory that lists plugins w/ indeterminate shortcode names, for example.

    Ultimately, the problem could be solved if WordPress added an optional plugin header parameter:

    Plugin Name: My Plugin
    Plugin URI: http://example.com/
    Shortcodes: [shortcode], [shortcode2]

    It’d be easy to parse automatically, could be revealed in the WP UI in some way, and so forth.

Comments are closed.