Where to Put Custom Code for Your Website in WordPress –

Where to Put Custom Code for Your Website in WordPress - WP Mayor

Whenever you need to add custom code to your WordPress site, the typical recommendation is to put it in the theme’s functions.php file. I don’t like doing that as it’s easy to forget to copy-paste that code to the new theme when it’s time to a refresh.

Moreover, if done in that manner, you don’t have the ability to switch on or off certain functions.

The solution for me has been the following plugins:

Pluginception – Lets you create plugins from within the WordPress dashboard. This is useful when I just want to create one plugin to dump all the custom functionality into and have it protected whenever I change themes.

Code Snippets – An excellent plugin that lets you create snippets of code as functions that can be switched on or off at will, in the same way as you would with normal plugins.

Do you like these solutions?

Related Articles

  • WordPress Developers to Follow

    Starting out in WordPress development? I recommend going through the WordPress core code as well as following the practices employed by the best WordPress coders out there. Check out this…

  • How to Add a Custom Cron Interval in WordPress

    For its cron functionality, WordPress has three defined intervals, but you can also add your own. Here’s how to do it.

  • Embedding Code in WordPress Posts and Pages

    Embedding code in WordPress posts and pages can be a fiddly process. Lets learn what are our options for displaying code on our sites.

  • Where to Put Custom Code for Your Website in WordPress - WP Mayor 1

    Learn how to group frequently used custom functions into re-usable plugins and check out the magic of the mu-plugins WordPress folder in this tutorial.

Keep reading the article at WP Mayor. The article was originally written by Jean Galea on 2019-12-31 03:35:01.

The article was hand-picked and curated for you by the Editorial Team of WP Archives.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

Your email address will not be published. Required fields are marked *

Show Your ❤️ Love! Like Us
Scroll to Top