Fix Modularity single post type admin links - #2132
Open
jeanfredrik wants to merge 2 commits into
Open
Conversation
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
marked this pull request as draft
August 5, 2026 11:43
jeanfredrik
force-pushed
the
fix/modularity-single-admin-menu
branch
from
August 5, 2026 11:50
df16436 to
da396a0
Compare
jeanfredrik
marked this pull request as ready for review
August 5, 2026 11:51
Contributor
There was a problem hiding this comment.
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 tooptions.php?page=modularity-editor&id=single-{postType}. - Add
parent_filehandling 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.
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.