I've built a theme from scratch which is named "core". Core has a child theme called "core_child". My child theme works perfectly and only contains the following:

  1. /images
  2. screenshot.png
  3. style.css

Today I needed to activate "core" to make some changes. I received the following error upon activation:

Fatal error: Cannot redeclare add_slug_body_class() in /Applications/MAMP/htdocs/fresh_install/wp-content/themes/core/functions.php on line 3

The error indicates that I have a functions conflict. This prompted me to open up my functions.php file. I renamed the function add_slug_body_class to body_slug_core and this re-produced the error:

Fatal error: Cannot redeclare body_slug_core() in /Applications/MAMP/htdocs/fresh_install/wp-content/themes/core/functions.php on line 3

Here's the function which is causing the problem:

// Page slug body class
function body_slug_core( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
return $classes;
add_filter( 'body_class', 'body_slug_core' );

Next I deleted the function completely. This produced the following error:

Fatal error: Cannot redeclare remove_default_image_sizes() in /Applications/MAMP/htdocs/fresh_install/wp-content/themes/core/functions.php on line 23

This error is referring to the next function within functions.php. Here's the code:

// Remove WP default image sizes
function remove_default_image_sizes( $sizes) {
    unset( $sizes['medium']);
    unset( $sizes['large']);
    return $sizes;
add_filter('intermediate_image_sizes_advanced', 'remove_default_image_sizes');

I repeated what I had tried for the first function (renaming and then deleting the function completely), but it simply flagged the next function as a conflict.

I have read that this can be caused by WordPress websites that have been compromised. This is not the case as I've only been running the themes locally via MAMP. I've changed the names of the functions which rule out any conflict with the WordPress core files.

I have tried a fresh install of WordPress with a clean database without any plugins running. To regain control of wp-admin, I have renamed the core theme folder to core_. This produces a further warning in wp-admin which may be unrelated:

Warning: implode(): Invalid arguments passed in /Applications/MAMP/htdocs/fresh_install/wp-includes/class-wp-theme.php on line 675

The warning disappears when I refresh the page.

WordPress Version: 3.8.3

1 Answer 1


The CSS for my parent theme (core) was incorrectly formatted. The code at the top read:

Theme Name: Core
Theme URI: http://www.domain.co.uk
Description:  The core theme.
Author: Squideyes
Author URI: http://www.domain.co.uk
Template: Core
Version: 1.0.0
Tags: clean, simple, easy

The Template: tag should only appear in the child theme css. This is what caused the functions conflict.

  • Glad you found a solution. When you're able (I think it's after 48 hours), be sure to mark your answer as Accepted so that it may help someone else with the same problem.
    – Pat J
    Apr 16, 2014 at 14:00
  • Thanks @PatJ. I knew it would be down to a silly mistake that I'd made.
    – Sam
    Apr 16, 2014 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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