• iWPer

    (@iwordpresser)


    Can I use has_shortcode and find out if the shortcode has a certain attribute?
    This probably runs to early in the loop to get the attribute(s), but it would be very helpful if this could be done efficiently.

Viewing 2 replies - 1 through 2 (of 2 total)
  • catacaustic

    (@catacaustic)

    No. The has_shortcode() function doesn’t check for any attributes that could be passed into the shortcode. As far as I know, there isn’t a function that does this, and that’s because there’s no standard set of attributes or way to get a default attribute set from a shortcode function.

    Thread Starter iWPer

    (@iwordpresser)

    Thank you!

    I know how to check the attributes when the shortcode activates my function. I was just hoping that I was missing something about has_shortcode (or a similar function) that could help me to check for these attributes earlier in the loop.

    I have now added an extra option in the plugin-settings-page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘has_shortcode and attribute’ is closed to new replies.