[resolved] Changes to functions.php (3 posts)

  1. doubleinfinity
    Posted 3 years ago #

    Is there a way to make changes to the functions.php file so that when my theme is updated I won't need to make the changes again?

    I require a piece of code to be removed from the (parent/original) functions.php file. Using a functions.php file in a child theme is great for adding new functions but not removing existing ones.

    Any ideas?


  2. AK Ted
    Posted 3 years ago #

    Unfortunately, no. But, you could ask the theme author to make their functions "pluggable". Basically, they would wrap their functions in an if statement, like:

    if( ! function_exists('some_theme_function') ) {
        function some_theme_function() {
            // function code

    That way, you could create a function some_theme_function in your child theme, overriding the parent's function.

    In the mean time, just comment out each parent function that you recreate in your child theme, and remember to re-comment them out each upgrade.

  3. doubleinfinity
    Posted 3 years ago #

    Great thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic