Title: Custom function in functions.php
Last modified: January 3, 2020

---

# Custom function in functions.php

 *  Resolved [syafiqsyazre](https://wordpress.org/support/users/syafiqsyazre/)
 * (@syafiqsyazre)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-function-in-functions-php/)
 * Hi,
 * What is the best practice to include the custom function in woocommerce.
 * Cause i noticed got two different functions.php which are in _wp-includes/functions.
   php_ and _wp-content/themes/twentytwenty/functions.php_.
 * If I put that custom function inside the theme folder, when updating theme the
   function will disappears. So i’ve include the function inside wp-content folder.
   But I’m not sure if it’s a best practice or not.
 * Regards,

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [crslz](https://wordpress.org/support/users/crslz/)
 * (@crslz)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-function-in-functions-php/#post-12288597)
 * If you do not want this you can easily create a plugin yourself
 * 1) Navigate to the WordPress plugins folder
    2) Create a new folder for your 
   plugin (my-functions-plugin) 3) Create the main PHP file for your plugin (my-
   functions-plugin.php) 4) Setup your plugin’s information
 *     ```
       <?php
       /**
        * Plugin Name: My Functions Plugin
        * Plugin URI: http://www.mywebsite.com/my-functions-plugin
        * Description: My Functions Plugin.
        * Version: 1.0
        * Author: Your Name
        * Author URI: http://www.mywebsite.com
        */
   
       //add_action( ... );
       ```
   
 * 5) Save and activate the plugin
 * From now on you can place everything you would put in the functions.php file 
   in your own plugin file
 * Regards
 *  Thread Starter [syafiqsyazre](https://wordpress.org/support/users/syafiqsyazre/)
 * (@syafiqsyazre)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/custom-function-in-functions-php/#post-12288958)
 * Hi,
 * That explains everything, thanks!
 * Regards,

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom function in functions.php’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [syafiqsyazre](https://wordpress.org/support/users/syafiqsyazre/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/custom-function-in-functions-php/#post-12288958)
 * Status: resolved