WP title mod: Fatal error

While using any theme besides Twenty Twelve, install and active the attached zip.

wp-title-mod.zip Download Zip

Expected Outcome

The pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party should activate without any errors.

Activate the theme Twenty Twelve and you will have either a white screen of death or an error 500.

Top ↑

How to fix

If you haven’t already, turn on debug by editing your wp-config.php file and changing the WP_DEBUG define to true: define('WP_DEBUG', true);

Now you’ll have an error like this:

Fatal error: Cannot redeclare twentytwelve_wp_title() in /Applications/MAMP/htdocs/wordpress/wp-content/themes/twentytwelve/functions.php on line 165

Top ↑

How to Fix

This error points the finger at your theme, rather than the plugin you just activated. If you want to revert themes, you will need to edit the database.

  1. Look in the wp-content/themes directory to find the directory name for another installed theme (or just go with twentyeleven, or twentyten as common defaults).
  2. Login to phpMyAdmin for your WordPress database and locate the options table (normally named wp_options).
  3. Look through the options table until you find options for template and stylesheet.
    Screen Shot showing theme name in the database
  4. Edit both options to use the name of the directory of an installed theme.
    Screen Shot showing updated theme name

Of course this doesn’t fix the problem. If you view the plugin source code, you’ll see the following:

// I saw this great function in Twenty Twelve and didn't change the function name!
function twentytwelve_wp_title( $title, $sep ) {
global $paged, $page;


add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );

In this case, this issue is caused by having two functions with the same name. Functions have to have unique names, otherwise a computer just won’t know what to do with them.

The ‘fix’ would be to rename twentytwelve_wp_title to something else. However realistically you don’t need the plugin at all anymore, since you’re using the actual theme Twenty Twelve.

Last updated: