Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #346430

    Hi,

    Here’s a great ‘How To’ I’d like to share! It enables you to:

    – Keep your custom functions after a theme update. So you don’t have to re-implement them after each theme update. Plus, you don’t need a child theme (handy for when it’s too late for child theme creation dev-wise).

    Okay, it’s pretty simple, just follow these steps:

    1 – Create a folder named “mu-plugins” (without quotes) in: yourwproot\wp-content\ (your normal “plugins” folder is in the same location). Sometimes the “mu-plugins” folder already exists;
    2 – Create a php file and name it “functions-custom” (again, no quotes), so its full name should be “functions-custom.php”**;
    3 – Add your custom functions to “functions-custom.php”**;
    4 – Copy the “functions-custom.php” file into your “yourwproot\wp-content\mu-plugins” folder.

    ** Please use the following base content for your “functions-custom.php” file:

    <?php
    /*
    Plugin Name: Custom Functions
    Plugin URI: http://yourwebsite.com
    Description: My custom functions.
    Version: 1.0
    Author: Your Name
    Author URI: http://yourwebsite.com
    */
    
    // Place your custom functions code below this line
    
    ?>

    That’s it! When you check the Plugins section, in the WP dashboard, you should see a section called “Must-Use”. Within the Must-Use section you should see a plugin called “Custom Functions”. Must-Use (MU) plugins are plugins WP will always use, no activation needed. Your custom functions now basically function as a Must-Use plugin. And since they are no longer directly part of your theme’s core files, they’ll survive theme and WP updates without problems.

    I hope this is useful to someone.

    Best,

    Ralph

    #346916

    Hi Ralph12!

    Thanks for the tips Ralph12.

    Regards,
    Elliott

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.