Many premium Wordpress themes come with a bulk of functionality and embedded wordpress/jquery plugins that aren't necessarily used at all in a certain project, so I'd assume weeding them out would result in a faster loading website. Removing excess javascript would obviously make the site to load a bit faster, at least upon first visitation.

But would it make any sense to remove for example the PHP used to create shortcodes that are never used, or any other PHP found in the functions files that is used to create unneeded functionality?

  • Feel free to change the theme as needed, I wouldn't mess with the wp core. If the theme has a lot of php functions that are not used, then removing them should reduce file size which reduces loading. It also reduces server side processing. – gdaniel Nov 1 '16 at 18:36

Functions and shortcodes that are never used, eat some processor time at launch, as WP is registering their existence. Deregistering them would take up some additional (and minimal) processor time.

Because they are loaded with functions.php they will reside in memory, either registered or deregistered. Which amounts to the same, as the code is never executed anyway.

Given how much time it would take to make sure they are not used and how little you would gain in performance, I wouldn't bother with it.

In addition to a smart answer @cjbt provided, I will just add few lines how I see themes may do things.

There are different approaches, to adding functionality.

  1. themes may load all functions and use only some functions.

  2. themes may load functionality based on some config file (file on disk)

  3. themes may load functionality based on some database settings.

You may guess, the 2) and 3) are better than 1).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.