How I can remove word "Archives" in head title in category page?
I'm using the Twenty Twelve theme and WordPress 4.
<head>
<title>"name of category" Archives | "name of sites"</title>
</head>
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityHow I can remove word "Archives" in head title in category page?
I'm using the Twenty Twelve theme and WordPress 4.
<head>
<title>"name of category" Archives | "name of sites"</title>
</head>
If you are using yoast SEO plugin then the easiest method is to remove the archive word from "titles & metas-> Taxonomies->category
"
find:
%%term_title%% Archives %%page%% %%sep%% %%sitename%%
replace it with:
%%term_title%% %%page%% %%sep%% %%sitename%%
Some points of interest:
wp_title()
is located with /wp-includes/general-template.php. This function performs two filters: wp_title_parts
and wp_title
, and in either instance you have the opportunity to manipulate the results of the standard wp_title()
.twentytwelve_wp_title
performs some magic specific to twentytwelve, and is activated using the wp_title
filter with priority 10.If you're not familiar with filters, I strongly recommend you look into it before getting too fancy with this. However, my suggested approach takes the following steps:
wp_title()
returns its string we have an opportunity to manipulate it using the wp_title
filter.
Thus, I suggest the following function, invoked using the wp_title
filter with a larger (executed later) priority of 11:
function overwrite_twentytwelve_archives_title($title, $sep)
{
// Look for the string " Archives" (note the leading space),
// and strip it out of $title:
return preg_replace("/ Archives/", "", $title);
}
add_filter("wp_title", "overwrite_twentytwelve_archives_title", 11, 2);
I took some liberty here in assuming that there would be an extra space in front of "Archives" that had to be stripped out as well (noted in the comments); adjust accordingly if you so desire. Basically, what I've suggested here is to allow Wordpress to go about its usual business, only to have the "Archives" bit stripped out just before it's actually displayed. Please note that I haven't tested this to work correctly, and if it doesn't I would be happy to put it through the ringer on my end.
Go this link (change www.yourwebsite.com with your domain )
www.yourwebsite.com/wp-admin/admin.php?page=wpseo_titles
then click on the tab : Taxonomies
The first tab is your target