In the documentation provided, it says it is not possible to edit functions.php via the child theme. So then how do I change it if I wanted to add a function script?
In WordPress child themes, you cannot directly override the parent theme's main functions.php file because both the parent and child functions.php files are loaded, with the child’s loading first and then the parent’s. This means the parent functions.php always runs, so simply duplicating functions.php in the child theme won’t replace the parent one.
You can add custom code in the child theme's functions.php file. The child theme’s functions.php does not override the parent’s functions.php; instead, both are loaded, with the child’s loading first, allowing you to safely add or modify functionality without altering the parent theme’s files. This is the recommended way to add custom PHP code so your changes remain intact after parent theme updates.
Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list.
So that means I just create a new functions.php in the child theme folder and put my code there?
Because I just did that with a piece of code of which I know it works (because I had it added to the main theme functions.php to test it out and it worked), but it seems like the child theme functions.php is not loaded.
In the documentation provided, it says it is not possible to edit functions.php via the child theme. So then how do I change it if I wanted to add a function script?
Hi,
In WordPress child themes, you cannot directly override the parent theme's main functions.php file because both the parent and child functions.php files are loaded, with the child’s loading first and then the parent’s. This means the parent functions.php always runs, so simply duplicating functions.php in the child theme won’t replace the parent one.
You can add custom code in the child theme's functions.php file. The child theme’s functions.php does not override the parent’s functions.php; instead, both are loaded, with the child’s loading first, allowing you to safely add or modify functionality without altering the parent theme’s files. This is the recommended way to add custom PHP code so your changes remain intact after parent theme updates.
Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list.
Regards, Oliver
So that means I just create a new functions.php in the child theme folder and put my code there?
Because I just did that with a piece of code of which I know it works (because I had it added to the main theme functions.php to test it out and it worked), but it seems like the child theme functions.php is not loaded.