No Code Attached Yet bug
avatar stefanoel
stefanoel
17 Jun 2025

Steps to reproduce the issue

  1. From backend, create two category: CAT1 and CAT2.
  2. Create an article, assign it to CAT1 and save it.
  3. Then, reassign the article to CAT2 and save again.
  4. Now, delete permanently CAT1.
  5. Edit the article, restoring the previous version (the one assigned to CAT1).
  6. The article content is restored. The Category field shows "CAT2" so I assume everything is ok.
  7. Don't save, click on Close (saving won't cause the issue).

Expected result

The content is restored and the article should be assigned to CAT2, the category showed in the Category field after the restore.

Actual result

The content is correctly restored, but looking at the list of articles I can see that the article has un undefined category, like this:

Article title
Alias: article
Category: » » (Trashed)

In the #__content table, the catid field has the id of CAT1, the removed category.
Viewing the article from frontend I get a 404 error, I guess because the article is assigned to a nonexistent category.

To resolve, I have to edit the article from the backend: the category field in the form shows automatically CAT2 (the first category available). Saving the article solves the problem, reassigning it to an existing category.

System information (as much as possible)

PHP 8, Joomla 5.3.1

Additional comments

From the frontend, reproducing the above steps, cause an additional problem because after restoring, the 404 error prevents me to access the edit form.

avatar stefanoel stefanoel - open - 17 Jun 2025
avatar joomla-cms-bot joomla-cms-bot - change - 17 Jun 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Jun 2025
avatar chmst chmst - change - 21 Jun 2025
Labels Added: bug
avatar chmst chmst - labeled - 21 Jun 2025
avatar Vineet7875
Vineet7875 - comment - 22 Jun 2025

When restoring an article version that was originally assigned to a now-deleted or trashed category, Joomla should:

Display the Restored Category as "Trashed"
In the article edit form, show the exact category from the restored version, even if it's trashed or deleted.
Display it in the dropdown as:
Category: CAT1 (Trashed)


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

avatar Vineet7875
Vineet7875 - comment - 22 Jun 2025

In Joomla, when an article’s category is deleted or trashed, trying to view that article shows a 404 error — even if the article itself exists and is published.

This happens because Joomla checks for the existence of the category while displaying the article, since categories are used for routing, layout, and access control.

But from a user’s point of view, this can be confusing. The article is valid, but it doesn't show just because its category is gone.

A better approach would be to still display the article. A single article should not be strictly dependent on its category. If we are displaying articles through a category view, then yes — it makes sense to check if the category exists. But for direct single article views, Joomla should skip the category check and allow the article to display normally.


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

avatar brianteeman
brianteeman - comment - 22 Jun 2025

No it should not.

avatar Vineet7875
Vineet7875 - comment - 22 Jun 2025

Hi @brianteeman ,
I’d really appreciate your thoughts on the above solutions. I'm happy to contribute further or help implement any part of this if it's considered worth improving. Looking forward to your review and feedback.


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

avatar brianteeman
brianteeman - comment - 22 Jun 2025

What you are suggesting is completely wrong. If a category is unpublished or trashed then any content in that category should not be visible. If you cahnge that behaviour then you break existing sites

Add a Comment

Login with GitHub to post a comment