I'm trying to remove the word "Archive" from the page title.
How to remove it? By adding a filter?
Example:
My collections Archive | My sitename
I'm trying to remove the word "Archive" from the page title.
How to remove it? By adding a filter?
Example:
My collections Archive | My sitename
Best to use Wordpress SEO by Yoast.
Within Titles & Metas go to the Taxonomies tab and update the Title template for Product Categories to remove the word Archive. Mine ended up looking like this:
%%term_title%% %%page%% %%sep%% %%sitename%%
you can rewrite the filter in functions.php so it fails, causing WooCommerce not the render it.
function override_page_title() {
return false;
}
add_filter('woocommerce_show_page_title', 'override_page_title');
I know this is an old post but I tried the answers here and it didn't work. I found the solution basing it off renegadesk's answer, but in addition of going to the Taxonomies Tab I also had to change it in the Post Types tab. See below:
Get Wordpress SEO by Yoast if you don't already have it, then click SEO > Titles & Metas > Post Types. Scroll down and look for the heading "Custom Post Type Archives". On the "Products", you can edit the content of this title. Mine now looks like this:
%%pt_plural%% %%page%% %%sep%% %%sitename%%
If you are using the Yoast SEO (Versión 8.1.2), the options were move to:
Yoast SEO -> Search Appearance -> Taxonomies.
In there look up by Product categories (product_cat) and open it.
Then remove the Archives string from the head.
In woocommerce there seem to be 3 instances of Archives (case sensitive) one in \wp-content\plugins\woocommerce\woocommerce-hooks.php around line 50 and 2 in \wp-content\plugins\woocommerce\woocommerce-template.php around lines 240 ish Perhaps one of those is what you're looking for and you may be able to modify code.
in addition to Ted C:
For this purpose Wordpress has already predifined functions starting with __return_. In this case the function you are looking for is __return_false.
add_filter('woocommerce_show_page_title', '__return_false',10,0); will also work.
The last two params are the order of the function and the number of params passed to it.
It is always a good pratice to set them up but this is only necessary if you want to modify the default order (10) and the number of params passed (1).
wp-content/plugins/woocommerce/templates/archive-product.php
Edit this file archive-product.php and remove the below 3 lines.
<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
This will remove page title on shop page and all other pages.