fix: do not remap core meta caps in access checks - #7627
Open
faisalahammad wants to merge 3 commits into
Open
Conversation
Signed-off-by: Scott Kingsley Clark <lol@scottkclark.com>
Removed the Plugin ID from the header comments. Signed-off-by: Scott Kingsley Clark <lol@scottkclark.com>
Keep read_post, edit_post, and delete_post canonical in pods_access_map_capabilities so WordPress resolves them itself. Prevents a PHP warning from map_meta_cap for post types using a page capability type with meta capability mapping disabled. Fixes pods-framework#7619
faisalahammad
requested review from
JoryHogeveen and
sc0ttkclark
as code owners
September 11, 2026 19:23
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.
AI disclosure: this PR was written with GLM 5.3 flash assistance, reviewed and tested by me.
Description
Item-level access checks in
pods_access_map_capabilities()were rewriting the canonical meta capabilitiesread_post,edit_post, anddelete_postthrough the post type capability object before passing them toWP_User::has_cap(). For a pod with a page capability type,read_postbecomes the literal stringread_page. When that post type also has meta capability mapping disabled ("Full User Capabilities" unchecked),map_meta_cap()in WP 7.1 core reads the nonexistent$post_type->cap->read_pageproperty and triggers a PHP warning for logged-out visitors.The fix keeps those three meta caps canonical and lets core resolve them against the capability object itself, which it already does for every other path. I traced each capability flavor (post, page, custom) with mapping on and off: the outcomes are identical in every combination except the broken one, where the warning disappears.
Backward compatible: yes, no breaking changes.
Related GitHub issue(s)
Fixes #7619
Testing instructions
WP_DEBUG_DISPLAYenabled, visit the single item front-end view on WP 7.1.PHP Notice: Undefined property: stdClass::$read_page in wp-includes/capabilities.phpappears.Tested manually: confirmed this resolves the reported issue.
Screenshots / screencast
Not applicable, no UI changes.
Changelog text for these changes
Bug: Item-level access checks no longer rewrite read_post, edit_post, or delete_post through the post type capability object, which prevents a PHP warning from map_meta_cap when a post type with a page capability type has meta capability mapping disabled. #7619 (@sc0ttkclark)
PR checklist