I have installed meta tag modules,then enable the meta:views mudule for meta tags. After that i have added meta tags from views interface. Now I need to override these value on the basis of exposed filter dropdown.I mean when i change filter,then meta values should be changed.

1 Answer 1


You can use hook_metatag_metatags_view_alter

 * Implements hook_metatag_metatags_view_alter().
 function mymodule_metatag_metatags_view_alter(&$output, $instance, $options) {
   if (isset($_GET['some_filter']) && $_GET['some_filter'] == 'some value') {
     $output['title']['#attached']['metatag_set_preprocess_variable'][0][2] = t('New meta title');
    $output['description']['#attached']['drupal_add_html_head'][0][0]['#value'] = t('New meta description');

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.