Skip to main content

Why the page builder shows a curated set of elements and keeps the rest in a library, rather than shipping all of them in the picker

· 5 min read
Jon-Michael Lastimosa
Senior Web Developer

The question: "I just want to give the users the feeling of a very lightweight and unbloated page builder. Perhaps we update the page builder shortcodes by showing only all the essential shortcodes. The rest can be downloadable via the library. Shortcodes like the Before / After are rarely used — these should be just 'available on request', right?"

Context​

The page builder registers 77 elements. On disk that is a few hundred KB of mostly-idle PHP, and the front end only enqueues assets for the elements a page actually uses — so the real cost is small. But the picker shows every element as a tile across six tabs, and a wall of tiles reads as "bloated" regardless of what it weighs. The goal was the feeling of a lean builder, with the long tail still one click away.

Three things had to be settled: how to trim the picker without breaking anything, where an add-on shortcode lives once installed, and whether the person installing one should choose that location.

An audit of the subsystem found that much of the delivery machinery already exists: a catalog-driven Library (install / update / remove, version checks, checksum-verified payloads) installs official shortcodes into the active theme's customization tree, and a separate uploader installs pasted ones into the WordPress uploads directory. All three locations — the plugin's own folder, the theme tree and uploads — are already loaded at runtime, in that order of precedence.

Options considered​

  • Delete the rarely-used elements. Simplest picker, but it removes capability and breaks any page already using one of them.
  • Curate with the existing enable/disable setting. The setting already exists — but disabling an element un-registers it, so a page that already uses it stops rendering. Curation and content-safety are in conflict here.
  • Curate at the tile layer. Hide the tile in the picker while the element stays registered and renderable. The long tail moves behind an "Open Shortcodes Library" entry. No content is ever at risk.
  • Let the installer ask where to put each shortcode (theme vs plugin vs uploads). Flexible, but most people installing an element do not know the trade-offs, and a wrong choice fails silently later (a theme-tree install vanishes on a theme switch; a plugin-folder install is wiped by an update; an uploads install is flagged by security scanners).
  • Decide the location by provenance, automatically. A shortcode is either the site's own (hand-written, or generated for this one site) or an official reusable add-on. That distinction already determines the right home, so the person never has to.

Decision​

  • Curate the picker at the tile layer, never by disabling. The picker shows a curated essentials set; everything else is reachable through an Open Shortcodes Library entry. Hidden elements stay registered, so existing pages keep rendering.
  • Location is decided by provenance — there is no location selector. A shortcode that is bespoke to a site (written by a developer, or generated for that one site) lives in the active theme's customization tree, the way custom elements always have — it travels with the site's code and survives plugin updates. An official, reusable shortcode is installed through the Library catalog into the location the product controls.
  • Retire the uploads install path. With bespoke elements routed to the theme and official ones to the Library, the uploads install target has no remaining job — and it is the one location that carries the "executable PHP under uploads" problem. It is removed behind a migration that first moves anything already installed there into the theme tree, so nothing stops rendering.
  • Installing add-on code into the plugin's own folder is deferred, not adopted. The theme tree already survives plugin updates, so the plugin-folder route (which a plugin update wipes, and which would need a stamped manifest plus a reconciler to restore after every update) buys only theme-independence. That is a narrow benefit for real added complexity, so it is left as a possible later step rather than part of this work.

Why​

The expensive failure here is a blank or broken page, and it runs in one direction: anything that un-registers an in-use element, or removes a location a live page depends on, can erase content a visitor is looking at. Curating at the tile layer and migrating before retiring uploads both keep that from happening.

A location selector trades a one-time convenience for a recurring, silent trap — the person least able to judge "theme vs plugin vs uploads" is the one the dropdown asks. Provenance already answers the question with no choice to get wrong: site-specific code belongs with the site, product code belongs with the product.

And the lean-builder feeling was mostly a presentation problem, not a delivery one. Trimming the picker gets almost all of the benefit; the heavier plumbing (a reconciler to keep add-on code in the plugin folder across updates) addresses a corner case — surviving a theme switch — that few sites ever hit, so it waits until something actually needs it.

Status​

Accepted. Curating the picker and retiring the uploads path are planned as phased work; see the Shortcodes roadmap. The plugin-folder-plus-reconciler option is recorded here as deferred, so the reasoning is not lost if it is ever revisited.