# How to modify a post title suffix on filter change?

**URL:** <https://forum.bricksbuilder.io/t/how-to-modify-a-post-title-suffix-on-filter-change/39247>\
**Category:** How To\
**Tags:** how-to\
**Created:** [May 22, 2026, 7:25am UTC](https://forum.bricksbuilder.io/t/how-to-modify-a-post-title-suffix-on-filter-change/39247 "2026-05-22T07:25:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shemzone](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/shemzone/32/33428_2.png) [@Shemzone](https://forum.bricksbuilder.io/u/Shemzone)\
**Post date:** [May 22, 2026, 7:25am UTC](https://forum.bricksbuilder.io/t/how-to-modify-a-post-title-suffix-on-filter-change/39247/1 "2026-05-22T07:25:40Z")

</div>

Hi fellows

I have a function which add a suffix to {post\_title} depending of an url parameter. (ie. www.mysite./en/artists-studios/?shz\_dept%5B%5D=cher-18-en)  
I use it on a archive page as this: “Artists’ studios {echo:shz\_get\_departement\_name\_by\_query\_vars(label)}”. This page has also filters select.

At this time, the {echo:shz\_get\_departement\_name\_by\_query\_vars(label)} does not get the new category name on filter change, even if the url parameter has changed.

It’s work fine if I open a new window directly with the url parameter or if I click on a link having the url parameter.

I guess there is something to do regarding the ajax request but I don’t know where to look or what is missing in my function.

Thanks a lot for your help.

```auto
function shz_get_departement_name_by_query_vars( $key ) {
    // Retrieves from $_REQUEST (GET + POST) or $key
    $departement_input = $_REQUEST["shz_dept"] ?? $key ?? '';
    
    // Handles array cases (shz_dept[] in the URL or in the POST request)
    $departement_slug = sanitize_text_field(
        is_array($departement_input) ? ($departement_input[0] ?? '') : $departement_input
    );

    if (!empty($departement_slug)) {
        $category = get_term_by('slug', $departement_slug, 'category');
        if ($category && !is_wp_error($category)) {
            return ' - ' . $category->name;
        }
    }

    return '';
}

```
