I am using WooCommerce and I am trying to find a way to update the archive page default title <title></title> with the selected attribute(s) when the results are filtered.

For example:


The archive page title is:


But, when I filter it (via the filtered widgets included with WooComerce).


The archive page title still shows:


What I would like it to show:

<title>Red Shoes</title>

Is this possible?

1 Answer 1


You will have to add the variable ?filter_color to your title tag. Something like this-

    $filter_color = $_REQUEST['filter_color'];

This line of code will get the value from the URL. (Make sure this line of code runs before the HTML where you want to output it)

And then in your HTML it should look pretty much like this-

    if( $filter_color ) {
        echo '<title>'. &filter_color .' Shoes</title>';

    else {
        echo '<title>Shoes</title>';

Here we checked weather there was a variable set for filter_color or not and adjusted the output accordingly.

  • Thanks so much Neit, I'm going to give this a go and see how it works :-) Is this also what you would do to echo it between a heading tag? For example: <h4>"filter name" Shoes</h4>?
    – Jeremia
    Dec 9, 2016 at 0:40

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.