• For the longest time, I’ve been adding custom functions in the functions.php file to add or remove functionalities to the WordPress website I have. Now, I want to get into the habit of putting these codes into basic plugins. My question is if adding these functions to the site through plugins will increase the server memory and other resources usage more than if I put the code in the functions.php file?

    • This topic was modified 2 years, 1 month ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    No, not really. There may be a few bytes here and there, but the code is the code.

    Dion

    (@diondesigns)

    Using a plugin will add some files to your filesystem, a hundred or so bytes to the database, and potentially some bytes to memory usage. However, if you created a child theme for the sole purpose of adding code to functions.php, then using a plugin will reduce the filesystem, database, and memory usage because the child theme can be deleted.

    The biggest difference is that the plugin’s code will be available to all themes, not just the one that previously contained the code.

    Plugin code starts executing before theme code, which could be a plus or a minus depending on your code.

    Thread Starter wpmhweb

    (@wppit)

    @sterndata thanks for the info

    Thread Starter wpmhweb

    (@wppit)

    @diondesigns thank you. I’m creating a meta box in the editor to pick an option from a list of options, and I was planning to add the code in a plugin. In your opinion should I just add the code to the functions.php or it’s better to add a plugin. I use only one theme that I created and maintain.

    • This reply was modified 2 years, 1 month ago by wpmhweb.
    Dion

    (@diondesigns)

    If the code you’re describing is specific to the theme, and you’re not creating a child theme solely for this code, then put the code in the theme’s functions.php. Otherwise, it probably makes more sense to create a plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Will creating plugin increase memory more than if put code in functions.php?’ is closed to new replies.