AdvancedCustomFields / AdvancedCustomFields/acf

Cannot show field group related to user when acf_form is called from a regular page

Open
#96 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Reproducing the issue

WP

Create a regular WordPress page which we will use as a placeholder to edit profile data. Name that page Edit account.

THEME - On page.php, insert the code :
<?php acf_form([
    'post_id'  => 'user_1',
    'form'     => false,
    'return'   => null,
    'uploader' => 'basic',]); ?>

<?php echo "Just to make sure I am printed"; ?>

This template is used by the Edit account page created in step 1 and thus should show the form.

ACF SETUP

image

BROWSER

While logged-in, I refresh the "Edit account" page on the frontend.

The form does not show up at all.

ACF is not picking up the fact that I request to show all fields in the "user" context, even when not on a user form, even on that "edit account" page.

OBSERVATIONS
  • I properly see my own debug text ("Just to make sure I am printed").
  • The form is printed without any fields from the above group
  • The form contains some fields which have never been set anywhere else (_validate_email)
  • if I add a rule "OR current user is logged in" the form shows up (but that is too broad)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue from the page.php example using acf_form with post_id set to user_1, then inspect how the form resolves field groups for a regular WordPress page. Done means the user-related field group appears on the frontend form without requiring the overly broad logged-in-user rule, while unrelated fields are not included.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.