Does registering multiple shortcodes impact performance?

Haven’t actually seen plugins with 30 shortcodes, but my opinion on this is, it is too much and I would really want to know what are all these shortcodes for.

To come back to the actual issue, shortcodes is slower than normal functions because they need to be parsed. This differences should be minute though. The real performance issues comes in when it come to what the shortcode is suppose to be doing. It is obvious that a shortcode displaying a site tiyle will be faster than one querying a bunch of posts

Shortcodes come in very handy when you need to display certain specific stuff on pages. They are very dynamic and the output from pages can be quickly and easily be changed on the fly by just altering the shortcode attributes. In a situation like this, the slight decrease in performance is really worth the while when you look at the overall gain and advantages. One big advantage sometimes overlooked is the fact that you can have one page template for all pages, yet each page can have unique contents according to the shortcode being used inside the page.

Shortcodes are also portable (that is why shortcodes should always go into a plugin) and let you keep functionality even if you switch themes. This simply means that you don’t need to alter page templates everytime you switch themes, you can just simply place the shortcode where needed

It is quite easy to know when shortcodes are too much for the job at hand, and the following defeats the real purpose of shortcodes

  • If you need to use do_shortcode(), you are doing it wrong. Here the decrease in performance is not worth the while. Because you need to hardcode the shortcode in your template, it will be much more effecient to just create a function and calling the function directly in the template

To conclude, if shortcodes are used correctly, are properly written and used for what they are meant to be used for, they are very handy and the advantages will out weight the slight disadvantage of performance time wise. It is up to you to look at your current setup and usage and decide if your current usage is really necessary.

To gain something good, you will have to be prepared to loose something else in order to gain