WordPress Child Themes

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Wordpress Theme Tutorial  //  No Comments

I’m trying to redeclare a function in a wordpress child theme that is already in use by the parent theme. However, I get a “Fatal error: Cannot redeclare” message when trying to do so.

You cannot override that function, as the parent theme’s declaration is executed after your declaration, and it doesn’t try to check if the function already exists.

The only way would be to wrap the parent theme’s function declaration inside the if condition.

if (!function_exists('jr_load_scripts')) {


Leave a comment

Share This Post

RSS Wordpress News