PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar CSGoat0
CSGoat0
20 Apr 2026

Pull Request resolves #40668.

  • 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

This PR fixes a routing bug in com_tags where the types[] parameter (content type filter) is incorrectly appended as a query string to SEF URLs instead of being properly absorbed by the router.

Current problematic behavior: When a menu item of type "Tagged Items" has one or more content types selected (e.g., Article, Contact, News Feed), the types[] parameters are appended to the URL as query strings.

Examples of the bug:

  • Single content type: /tags/exhibitions?types[0]=1
  • Multiple content types: /tags/exhibitions?types[0]=1&types[1]=2

Solution: The router now compares the types[] parameters in the URL against the content types configured in the menu item. If they match exactly, the parameters are removed from the URL since they are redundant (the menu item already stores this information). This follows the same pattern already used for comparing tag IDs in the router.

Modified file: components/com_tags/src/Service/Router.php

Testing Instructions

How to Replicate the Issue

Follow these steps on a fresh Joomla installation:

1. Enable SEF URLs

  • Go to System → Global Configuration → Site
  • Set the following:
    • Search Engine Friendly URLs: Yes
    • Use URL Rewriting: Yes
  • Rename htaccess.txt to .htaccess if needed (or configure your local server environment)

2. Create a tag

  • Navigate to Components → Tags → Add New Tag
  • Title: "exhibitions"
  • Alias: "exhibitions"
  • Save & Close

3. Create content items

  • Go to Content → Articles → New
  • Create 2-3 test articles
  • Assign the "exhibitions" tag to each article
  • (Optional for testing multiple content types): Create a contact and assign the same tag:
    • Components → Contacts → New
    • Create a test contact
    • Assign the "exhibitions" tag
    • Save

4. Create the menu item

  • Navigate to Menus → Main Menu → Add New Menu Item
  • Menu Item Type: Tags → Tagged Items
  • Choose Tag: Select "exhibitions"
  • Select Content Type: Check one or more content types (e.g., "Article" or "Article" + "Contact")
  • Alias: "exhibitions"
  • Save

5. View the frontend

  • Navigate to your menu item
  • Observe the URL - You will see the types[] parameter(s) appended:
    • Single content type: ?types[0]=1
    • Multiple content types: ?types[0]=1&types[1]=2

6. The workaround (demonstrates this is a bug)

  • Edit the menu item
  • Uncheck all options under "Select Content Type"
  • Save and refresh the frontend
  • The URL parameter disappears - proving that when no types are selected, the router behaves correctly

Testing the Fix

Test Case 1: Single content type (Article only)

  1. In the menu item, select ONLY "Article" under "Select Content Type"
  2. Save the menu item
  3. View the frontend
  4. Expected: Clean URL without ?types[0]=1

Test Case 2: Multiple content types (Article + Contact)

  1. Edit the menu item
  2. Select BOTH "Article" and "Contact" under "Select Content Type"
  3. Save the menu item
  4. View the frontend
  5. Expected: Clean URL without ?types[0]=1&types[1]=2

Test Case 3: Different single content type (Contact only)

  1. Edit the menu item
  2. Select ONLY "Contact" (deselect Article if selected)
  3. Save the menu item
  4. View the frontend
  5. Expected: Clean URL without ?types[0]=2

Test Case 4: No content types selected (all types)

  1. Edit the menu item
  2. Deselect all content types under "Select Content Type"
  3. Save the menu item
  4. View the frontend
  5. Expected: Clean URL (already worked correctly)

Test Case 5: User override (preserves intentional overrides)

  1. Ensure the menu item has Article only selected
  2. Manually type in the browser: https://mysite.com/tags/exhibitions?types[0]=1&types[1]=2
  3. Expected: The URL keeps the parameters because they differ from the menu item's configuration (user explicitly requested to see both Articles AND Contacts)

Actual result BEFORE applying this Pull Request

Test Case 1 (Single type - Article):

https://mysite.com/tags/exhibitions?types[0]=1

Test Case 2 (Multiple types - Article + Contact):

https://mysite.com/tags/exhibitions?types[0]=1&types[1]=2

Test Case 3 (Different single type - Contact only):

https://mysite.com/tags/exhibitions?types[0]=2

Test Case 4 (No types - all content types):

https://mysite.com/tags/exhibitions

(This case already works correctly)

The types[] parameters are appended as query strings regardless of how many content types are selected, making URLs unnecessarily long, less user-friendly, and inconsistent with Joomla's SEF URL patterns.

Expected result AFTER applying this Pull Request

Test Case 1 (Single type - Article):

https://mysite.com/tags/exhibitions

Test Case 2 (Multiple types - Article + Contact):

https://mysite.com/tags/exhibitions

Test Case 3 (Different single type - Contact only):

https://mysite.com/tags/exhibitions

Test Case 4 (No types - all content types):

https://mysite.com/tags/exhibitions

Test Case 5 (User override - different from menu item):

https://mysite.com/tags/exhibitions?types[0]=1&types[1]=2

(Preserved because user explicitly requested different content types)

All URLs are clean and free of redundant types[] query parameters when they match the menu item's configuration. The content type filtering still works correctly because the menu item already stores this information in its parameters. User overrides are respected.

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 - 20 Apr 2026
avatar CSGoat0 CSGoat0 - change - 20 Apr 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Apr 2026
Category com_tags Front End
avatar CSGoat0 CSGoat0 - change - 20 Apr 2026
Labels Added: PR-5.4-dev
avatar CSGoat0 CSGoat0 - change - 20 Apr 2026
The description was changed
avatar CSGoat0 CSGoat0 - edited - 20 Apr 2026

Add a Comment

Login with GitHub to post a comment