PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar CSGoat0
CSGoat0
8 May 2026

Pull Request resolves #43627

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Removed the condition && $includeChildren != 1 from the HAVING clause check in TagsHelper::getTagItemsQuery().

File changed: libraries/src/Helper/TagsHelper.php (line 418)

Before:

if ($ntagsr > 1 && $anyOrAll != 1 && $includeChildren != 1) {

After:

if ($ntagsr > 1 && $anyOrAll != 1) {

This change allows the "Match All" setting to work correctly when "Include Child Tags" is enabled. Previously, the HAVING clause was skipped entirely when child tags were included, causing the query to default to "Match Any" behavior.

Testing Instructions

Step 1: Create test tags

  1. Log in to Joomla Administrator
  2. Navigate to Components → Tags
  3. Click New to create the following tags:
    • Tag A (e.g., "Fruits")
    • Tag B (e.g., "Vegetables")
  4. For Tag A, create a child tag:
    • Click New
    • Title: e.g., "Apples"
    • In the Parent field, select "Fruits"
    • Click Save & Close
  5. For Tag B, create a child tag:
    • Click New
    • Title: e.g., "Carrots"
    • In the Parent field, select "Vegetables"
    • Click Save & Close

Step 2: Create test articles

  1. Navigate to Content → Articles

  2. Create the following three articles:

    Article Title Tags to assign
    Article 1 Only Tag A (Fruits)
    Article 2 Tag A (Fruits) AND Tag B (Vegetables)
    Article 3 Only Tag B (Vegetables)
  3. For each article, click Save & Close

Step 3: Create the menu item

  1. Navigate to Menus → All Menu Items (or select your desired menu, e.g., Main Menu)
  2. Click New
  3. Menu Title: Enter "Tagged Items Test"
  4. Menu Item Type: Click Select → under TagsTagged Items
  5. In the Tags field, select both Tag A and Tag B
  6. Click the Item Selection Options tab
    • Match Type: Select All
    • Child Tags: Select Include
  7. Click Save & Close

Step 4: Test on the frontend

  1. Open your site frontend
  2. Navigate to the menu item you just created (e.g., "Tagged Items Test")
  3. Observe which articles are displayed

Expected result

Only Article 2 appears (the article that has both Tag A and Tag B)

Actual result BEFORE applying this Pull Request

When "Match Type: All" and "Child Tags: Include" are both selected with two or more tags:

  • Articles appear as if "Match Type: Any" was selected
  • Article 1, Article 2, and Article 3 all appear
  • Items tagged with only one of the selected tags (or their children) are incorrectly included

Expected result AFTER applying this Pull Request

When "Match Type: All" and "Child Tags: Include" are both selected with two or more tags:

  • Only items that have all selected tags (or tags from their child subtrees) appear
  • Article 2 appears
  • Article 1 and Article 3 do NOT appear

Additional Test Cases for Child Tag Combinations

To verify that the fix works correctly with child tags, please run the following additional tests using the same menu item (keep "Match Type: All" and "Child Tags: Include" selected):

  • Test 1: Replace Tag A (e.g., "Fruits") with one of its children, e.g., "Apples". Keep Tag B as "Vegetables".
    Expected result: Same as before — only Article 2 appears (because Article 2 has both "Apples" from Tag A's family and "Vegetables" from Tag B's family).

  • Test 2: Replace Tag B (e.g., "Vegetables") with one of its children, e.g., "Carrots". Keep Tag A as "Fruits".
    Expected result: Same as before — only Article 2 appears (because Article 2 has both "Fruits" from Tag A's family and "Carrots" from Tag B's family).

  • Test 3: Replace Tag A (e.g., "Fruits") with one of its children, e.g., "Apples", AND replace Tag B (e.g., "Vegetables") with one of its children, e.g., "Carrots".
    Expected result: Same as before — only Article 2 appears (because Article 2 has both "Apples" from Tag A's family and "Carrots" from Tag B's family).

  • Test 4: Replace only one tag (either Tag A or Tag B) with a child tag, and ensure the other tag is NOT present in any article.
    Expected result: No articles appear (because no article has tags from both families).

These tests confirm that the "Match All" logic correctly follows tag hierarchies when child tags are included, regardless of whether the selected tags are parents or children.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:
  • No documentation changes for guide.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed
avatar CSGoat0 CSGoat0 - open - 8 May 2026
avatar CSGoat0 CSGoat0 - change - 8 May 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 May 2026
Category Libraries
avatar CSGoat0 CSGoat0 - change - 8 May 2026
Labels Added: PR-5.4-dev
avatar CSGoat0 CSGoat0 - change - 10 May 2026
The description was changed
avatar CSGoat0 CSGoat0 - edited - 10 May 2026
avatar MacJoom
MacJoom - comment - 23 May 2026

Tested successfully on 5.4.5 with Patchtester


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47742.

avatar MacJoom
MacJoom - comment - 23 May 2026

Tested successfully on 5.4.5 with Patchtester


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47742.

avatar richard67
richard67 - comment - 23 May 2026

Tested successfully on 5.4.5 with Patchtester
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47742.

@MacJoom Have you used the blue "Test this" button in the issue tracker? It seems your test was not counted. See https://issues.joomla.org/tracker/joomla-cms/47742 .

avatar MacJoom MacJoom - test_item - 23 May 2026 - Tested successfully
avatar MacJoom
MacJoom - comment - 23 May 2026

I have tested this item ✅ successfully on 3d9fc3b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47742.

avatar MacJoom
MacJoom - comment - 23 May 2026

I have tested this item ✅ successfully on 3d9fc3b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47742.

Add a Comment

Login with GitHub to post a comment