WordPress.org

Ready to get started?Download WordPress

Forums

Could we have better support for managing shortcode conflicts (1 post)

  1. OllieJones
    Member
    Posted 1 year ago #

    As WordPress's ecosystem grows, there seems to be a growing potential for conflict between shortcodes.

    Now a plugin or template developer can definitely do a hack like this:

    function add_shortcode_conditional($tag, $func) {
    	global $shortcode_tags;
            if ( ! empty ( $shortcode_tags[$tag]) ) {
                  add_shortcode($tag, $func);
            }
            else {
                 /* recover somehow or other */
            }
    }

    But, it would sure be nice if a future WP version had some kind of built-in support for resolving conflicts, and a blessed interface for looking at $shortcode_tags. An add_shortcode filter would also be convenient.

    Ideally, there'd be a priority system like the filter system, where a higher-numbered shortcode handler would override a lower-numbered one.

    Thanks for considering this.

Topic Closed

This topic has been closed to new replies.

About this Topic