Suggestions for speeding up a page/post with a bunch of shortcodes?

[ad_1]

A coworker and I are trying to create a automatically-generated review page/post for our organization’s weekly email newsletter, which consists of either the full content of posts or excerpts from a selection of posts. His plan is that eventually, he wants to use the Newsletter plugin to generate the newsletter based on a selection of current posts on the site.

I’ve created several shortcodes that pull in the posts, and those are (for the most part) working in terms of displaying what we want them to display. But the page/post (we’ve tried both) that contains the shortcodes takes a looooooooooong time to load, and really drives up the RAM usage on our site.

The shortcodes all work basically the same way. There are a bunch of attributes to allow customization of which posts to display, based on the post category, the values of a handful of ACFs, publication date of the post, etc.

Some of the shortcodes do some calculations related to the ACFs (primarily date/time values); some do not.

The shortcodes are around 150 lines, give or take.

There are currently 10 shortcodes in a single custom post type, plus 6 custom HTML blocks and a heading. The custom post type has been modified so that it doesn’t include any extraneous headers, footers, etc., but it does pull in the site’s custom HTML.

I’m looking for general suggestions about shortcodes, like:

* Does having more attributes slow things down?
* Does calling external functions for returning content (instead of having the code inside each shortcode) slow things down?

[ad_2]
1 Comment
  1. *Does having more attributes slow things down?*

    No. It all depends on how you use/process the attributes.

    *Does calling external functions for returning content (instead of having the code inside each shortcode) slow things down?*

    Define “external function”? Like, WP functions? No, that doesn’t slow things down.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer