AdvancedCustomFields / AdvancedCustomFields/acf
get_fields not returning all fields
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
I have a custom post type with about a dozen custom fields. Before rendering the template that displays this post type I create a new object with this constructor:
/**
* Initialize the class and set its properties.
*
* @param WP_Post|null $post
* @param array $meta
* @param array $fields
*/
public function __construct( ?WP_Post $post, array $meta, array $fields ) {
$this->post = $post;
$this->meta = $meta;
$this->fields = $fields;
}
I initialize the last arg with $fields = get_fields( $post_id ). When I run this in Xdebug, however, that $fields arg only contains a limited set of the total fields for that object. I have to instead run get_post_meta and work with the raw meta values instead.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported get_fields($post_id) call and compare its returned fields with the values from get_post_meta. Confirm which custom fields are omitted and under what post conditions; done means get_fields returns the complete set of fields expected for the custom post type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100