WordPress Plugin or the Theme's functions.php?

Genuine site functionality kept in a dedicated plugin so it survives a theme change, distinct from presentational tweaks in the theme itself

Why the Distinction Matters

A theme is meant to control presentation — layout, styling, visual structure — while a plugin is meant to add functionality independent of how the site looks. Mixing genuine functionality into functions.php ties that functionality's survival to the theme staying active, which becomes a real problem the moment anyone changes themes, whether deliberately (a redesign) or accidentally (switching to troubleshoot an unrelated issue).

What Belongs Where

  • Custom post types, taxonomies, shortcodes, and integrations should always live in a plugin — these represent site functionality and data structure that has nothing to do with which theme happens to be active.
  • Purely visual tweaks specific to the current theme's markup (adjusting how the theme itself renders something) are reasonable in a child theme's functions.php, since they're inherently tied to that theme's structure anyway.
  • A "must-use" plugin (placed in wp-content/mu-plugins) is worth considering for genuinely critical functionality that should never be accidentally deactivated, since MU plugins can't be turned off through the normal plugin interface.
  • A common mistake is building up a large, unmanageable functions.php over time simply because it was the easiest place to add "just one more thing," which eventually creates exactly the fragility a proper plugin structure avoids.

Getting This Right

  1. Ask whether the feature should survive a theme change — if yes, it belongs in a plugin.
  2. Create a small, dedicated site-functionality plugin rather than relying on functions.php for anything beyond genuinely presentational tweaks.
  3. Migrate existing functionality out of functions.php into a proper plugin if it's grown to include things that shouldn't be theme-dependent.

Need existing functions.php code properly reorganized into a maintainable plugin? See WordPress bug fix.

Available for new projects

NEXT STEP

Rather have it fixed than keep reading?

Based in Bangladesh — serving clients worldwide. Tell me what's happening and you'll have a reply within one working day.

  • Reply within one working day
  • Fixed quote before work starts
  • UK, EU and US hours covered