Skip to content

Fix rtMedia Compatibility with Hello Elementor Theme - #2226

Merged
NoumaanAhamed merged 1 commit into
developfrom
fix/theme-media-not-found
Dec 1, 2025
Merged

NoumaanAhamed merged 1 commit into
developfrom
fix/theme-media-not-found

Conversation

@NoumaanAhamed

@NoumaanAhamed NoumaanAhamed commented Dec 1, 2025 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes an issue where rtMedia Media tab show "The page can't be found" error when using Elementor's Hello theme.

Problem

When using Hello Elementor theme, visiting media pages (e.g., /members/admin/media/) displays a 404 error instead of the media gallery. This happens because Hello Elementor's minimal template structure checks is_singular() before loading the content template, and rtMedia wasn't setting this flag correctly.

Solution

1. Set Correct Query Flags

Updated rt_theme_compat_reset_post() in RTMediaRouter.php to properly set WordPress query flags:

// Before
'is_single'   => false,

// After  
'is_single'   => true,
'is_singular' => true,

This makes is_singular() return true for rtMedia pages, allowing themes like Hello Elementor to load the correct template that calls the_content().

2. Enhanced FSE Block Support

Added support for core/post-content block in addition to core/post-template:

// Before
if ( 'core/post-template' === $parsed_block['blockName'] ) {

// After
if ( 'core/post-template' === $parsed_block['blockName'] || 'core/post-content' === $parsed_block['blockName'] ) {

This improves compatibility with FSE themes that use the post-content block in single templates.

Changes

  • File: app/main/routers/RTMediaRouter.php
    • rt_theme_compat_reset_post(): Changed is_single from false to true, added is_singular set to true
    • rt_replace_the_content_fse(): Added core/post-content block name check

Testing

Theme Before After
Hello Elementor ❌ 404 Error ✅ Works
Twenty Twenty-Five (FSE) ✅ Works ✅ Works
Twenty Twenty-One (Classic) ✅ Works ✅ Works
BuddyPress Default ✅ Works ✅ Works

Test Steps

  1. Activate Hello Elementor theme
  2. Activate BuddyPress and rtMedia plugins
  3. Visit /members/{username}/media/
  4. Expected: Media gallery displays correctly
Image 5. Previously: "The page can't be found" error Image

Related Issue

Fixes: #2225

@rtBot

rtBot commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

Unable to PHPCS or SVG scan one or more files due to error running PHPCS/SVG scanner:

  • app/main/routers/RTMediaRouter.php

The error may be temporary. If the error persists, please contact a human (commit-ID: d666f4e).

@NoumaanAhamed NoumaanAhamed changed the title fix: Extend theme support to minimal classic themes like Hello Elementor Fix rtMedia Compatibility with Hello Elementor Theme Dec 1, 2025
@NoumaanAhamed
NoumaanAhamed marked this pull request as ready for review December 1, 2025 07:22
Copilot AI review requested due to automatic review settings December 1, 2025 07:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a compatibility issue where rtMedia pages display a 404 error when using Hello Elementor theme. The fix involves setting proper WordPress query flags (is_single and is_singular) to ensure themes recognize rtMedia pages as singular content.

  • Set is_single and is_singular query flags to true for rtMedia pages
  • Enhanced FSE block theme support by adding core/post-content block handling
  • Fixed typos and improved code documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NoumaanAhamed
NoumaanAhamed merged commit 2062afd into develop Dec 1, 2025
12 checks passed
@NoumaanAhamed
NoumaanAhamed deleted the fix/theme-media-not-found branch January 8, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Fix : Media tab Shows "Page Not Found" in Hello Elementor Theme

4 participants