Repository navigation
Fix Repeater pagination on Options Pages - #613
Merged
Merged
Conversation
Loading the next page of a paginated Repeater on an Options Page failed with "Sorry, you do not have permission to do that." The page loader ran a second, post-only check after the context check. It cast non-post IDs such as 'options' to 0, so it always failed. The context check already covers posts, so the second check is removed. The loader takes the field name from the request, because a nested Repeater is stored under a longer name than its own. Before loading rows, it now checks that the reference key stored under that name is this field's key. Values without a reference key, such as imported data, still load. Also give field_prefix a default, so loading a page no longer logs an undefined array key warning. Fixes #612. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cbravobernal
force-pushed
the
claude/issue-612-47ce87
branch
from
December 1, 2026 14:50
c71ebcf to
deda201
Compare
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.
On an Options Page, clicking Next on a paginated Repeater showed "Sorry, you do not have permission to do that."
The page loader (
ajax_get_rows()) ran a second, post-only check after the context check. It cast non-post IDs such as'options'to0, so it always failed. This PR removes it. Posts keep the sameedit_postcheck throughacf_current_user_can_edit_in_context(), and user profiles, terms, comments and Woo orders now work too, each with its own capability.The loader takes the field name from the request, because a nested Repeater is stored under a longer name than its own. It now checks that the reference key stored under that name is the requested field's key. Values without a reference key, such as imported data, still load.
It also gives
field_prefixa default, so a page load no longer logs an "undefined array key" warning.Testing instructions
acf_add_options_page(), using theedit_postscapability.vendor/bin/phpunit --filter Test_ACF_Field_Repeater_Ajax_Permissionscovers Options Pages, posts, a field name saved by another field, and Repeaters inside a Group or a Clone field.Closes #612
Use of AI Tools
This PR was written with Claude Code (Claude Opus 5.5): the fix, the tests and this description.
🤖 Generated with Claude Code