Skip to content

Fix Modularity single post type admin links - #2132

Open
jeanfredrik wants to merge 2 commits into
helsingborg-stad:mainfrom
whitespace-se:fix/modularity-single-admin-menu
Open

Fix Modularity single post type admin links#2132
jeanfredrik wants to merge 2 commits into
helsingborg-stad:mainfrom
whitespace-se:fix/modularity-single-admin-menu

Conversation

@jeanfredrik

@jeanfredrik jeanfredrik commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Single post type module menus currently use the full editor URL as their menu slug. For built-in and custom post types, that breaks WordPress admin-page matching and can leave users with a blank or inaccessible module view.

This registers a stable local submenu slug for each enabled post type, redirects from the page's early load-* hook to the shared Modularity editor, and preserves the originating parent and submenu context. Access continues to use each post type's existing edit capability without granting broader permissions.

Register local submenu slugs for enabled post types and redirect from the early load hook so the shared Modularity editor renders before admin output begins.

Preserve the originating post type menu and capability, including when another plugin relocates that menu.
@jeanfredrik
jeanfredrik marked this pull request as draft August 5, 2026 11:43
@jeanfredrik
jeanfredrik force-pushed the fix/modularity-single-admin-menu branch from df16436 to da396a0 Compare August 5, 2026 11:50
@jeanfredrik
jeanfredrik marked this pull request as ready for review August 5, 2026 11:51
@sebastianthulin
sebastianthulin requested a lite review from Copilot August 7, 2026 16:12

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 WordPress admin menu matching for “single post type” Modularity module pages by replacing the submenu slug (previously the full editor URL) with a stable local slug per post type, redirecting into the shared Modularity editor via the load-* hook, and ensuring the shared editor highlights under the originating post type menu via the parent_file filter.

Changes:

  • Register a stable submenu slug (modularity-editor-single-{postType}) for each enabled post type instead of using the full editor URL as the slug.
  • Redirect from the submenu page’s load-* hook to options.php?page=modularity-editor&id=single-{postType}.
  • Add parent_file handling to keep the shared editor page selected under the correct post type menu entry.

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

Comment thread Modularity/source/php/Options/SingleAdminPage.php Outdated
Use edit.php as the parent slug for the built-in post type while retaining query-based parents for pages and custom post types. This keeps the Post type modules submenu visible under Posts.
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants