The query that runs when you press load more ignores my hook_views_query_alter I am using for this view.

Created on 5 September 2019, almost 5 years ago
Updated 23 June 2023, about 1 year ago

I have a hook_views_query_alter function in a modulename.views_execution.inc file in one of my modules where I add a where condition to a specific taxonomy view. When the view first loads the where condition is applied but when I press on load more the articles being brought in seem to ignore my hook. This is my query alter hook code.

function mymodulename_views_query_alter(&$view, &$query) {
  $current_path = \Drupal::service('path.current')->getPath();
  $alias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);
  $id = $view->id();
  
  if($alias == "/someUrl" && $id == "taxonomy_term") {
    $query->addWhere(0, "tid", "222", "!=" );
  }
}
πŸ› Bug report
Status

Postponed: needs info

Version

1.6

Component

Code

Created by

πŸ‡¨πŸ‡ΎCyprus EliasPapa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Is this still an issue with 2.0.x? If yes, please update the version and set the status active again with clear steps or (best) with a test showing what's broken.

    2.0.x is the active development branch.

    If nobody replies, we should assume this is fixed and close this issue outdated.

    Thanks!

Production build 0.69.0 2024