0

When I copy an exact copy of the function.php file to the child theme folder I get this error.

Fatal error: Cannot redeclare archi_theme_setup() (previously declared in /home/desi3442/public_html/wp-content/themes/archi-child/functions.php:28) in /home/desi3442/public_html/wp-content/themes/archi/functions.php on line 71

I dont quite understand the error cause its pulling function.php from the main theme files when the child functions.php is supposed to overwrite it correct?

2

1 Answer 1

1

This is because the same function exists in the parent.

archi_theme_setup()

Since you are under the same namespace there will be a name collision — PHP cannot hold two functions with the same name.

enter image description here

When you set the child theme as the active one child theme functions.php will load first and then the other one frorm the parent.


You cannot just copy paste the code. Check the theme developer to provide you the child theme functions.php template.

Or use the empty template with the comments part in front.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.