You can’t use a function name in your child theme that is in use by your parent theme. Your parent theme likely has a function named load_stylesheets()
, so if you add a function with that name to your child theme you will get this error.
To work around this you need to give your child theme’s function a unique name. Issues like this is why it’s best practice to prefix your function names (eg. mytheme_load_stylesheets()
) or use namespaces.
Not that in some cases a parent theme might have “pluggable” functions. If a parent theme defines a function inside a condition, like this:
if ( ! function_exists( 'load_stylesheets' ) ) {
function load_stylesheets() {
// etc.
}
}
Then it will be possible to replace that function in your child theme by creating a new function with the same name. This is possible because the parent theme is checking that your child theme hasn’t already defined a function with that name before it defines it itself. If the parent theme does not perform this check then you can’t use the name.