Skip to content

[5.4] Fix Tags Menu URL Parameter Issue - #47638

Merged
muhme merged 7 commits into
joomla:5.4-devfrom
CSGoat0:fix/tags-menu-url-parameter-issue
Aug 26, 2026
Merged

muhme merged 7 commits into
joomla:5.4-devfrom
CSGoat0:fix/tags-menu-url-parameter-issue

Conversation

@CSGoat0

@CSGoat0 CSGoat0 commented Apr 20, 2026 •

Copy link
Copy Markdown
Member

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

@cyrez

cyrez commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on f61e729

Confirmed and tested on Joomla 6.1.3

Thank you @CSGoat0


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

@rbuelund

Copy link
Copy Markdown

I have tested this item ✅ successfully on f61e729


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

@alikon alikon removed the PBF Pizza, Bugs and Fun label Aug 22, 2026
@alikon

alikon commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 22, 2026
@richard67 richard67 added the bug label Aug 23, 2026
@muhme

muhme commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Final test before merge with JBT, 5.4.9-dev, MariaDB, PHP 8.5

  • Created all the content (including optional) as in the test instructions given
  • Seen types array issue in URL and 6. workaround before PR
  • Applied PR with gh pr checkout 47638
    • ✅ Tested all five cases successfully
    • ✅ Installed sample data, fix still works
    • ✅ Returned to before PR seen ?types[0]=1&types[1]=2, applied PR and changed order to ?types[1]=2&types[0]=1 -> URL is cleaned
    • ✅ Created more exhibitions articles and checked pagination and filtering is working with clean URL
    • Disabled Use URL Rewriting and moved .htaccess back to htaccess.txt, but ?types[0]=1&types[1]=2 are still removed from URL?
      • I assume, even this is not explicit stated in the PR, it is valid. It is analogous to 'index.php/component/tags/tag/millions?id=3' which is also cleaned to 'index.php/component/tags/tag/millions'.
    • ✅ No unusual Joomla or PHP log messages

@muhme
muhme merged commit 704b12d into joomla:5.4-dev Aug 26, 2026
76 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 26, 2026
@muhme

muhme commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Thank you very much @CSGoat0 for your contribution. Thanks to @cyrez and @rbuelund for testing.

@muhme muhme added this to the Joomla! 5.4.9 milestone Aug 26, 2026
@CSGoat0
CSGoat0 deleted the fix/tags-menu-url-parameter-issue branch August 26, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tag router. Tagged items URL gets ?types[0]=1

7 participants