WordPress Page Titles, Filters, and Child Themes

Themes are required to provide a wp_title() filter. If you’re making a child theme, you can’t remove that filter in your functions.php because the child theme loads before the parent. So here’s how you override the parent theme’s wp_title() filter. Assuming parent_wp_title() is the name of the parent theme’s filter:



/* declare your wp_title() filter */
function mytheme_wp_title($title, $sep) {
   ...your filter code here...
}

/* tell WordPress to remove the old filter, add the new one... but later. */
add_action('after_setup_theme','adjust_wp_title_filters');
function adjust_wp_title_filters() {
	remove_filter( 'wp_title', 'parent_wp_title', 10, 2 );
	add_filter( 'wp_title', 'mytheme_wp_title', 10, 2 );
}

Stick that in your functions.php, and you should be good to go