AdvancedCustomFields / AdvancedCustomFields/acf
Custom blocks renders only once within array of posts
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Hello.
I got some issues using posts inside custom blocks.
I am trying to create a custom block that will contain multiple posts that may contain other custom blocks. I need this to create some kind of table with multiple customizable tabs. Each post represents a tab.
Input:
An array of WP_Post objects provided by ACF inside the custom Gutenberg block
here is an example of code that as I think contains my problem
$features = get_field("features") ?: [];
foreach ( $features as $feature) {
echo apply_filters('the_content' , $feature["post"]->post_content);
}
Expected output
Content from each post with all custom blocks in it;
Actual output
Only one type of custom block rendered per array of posts.
As an example: if the first post contains a custom accordion block, then for the following posts accordion block won't be rendered.
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 provided get_field() and apply_filters('the_content', ...) reproduction, then trace how ACF and Gutenberg process each WP_Post in the loop. Confirm the behavior with multiple posts containing the same custom block; done means every post renders all of its custom blocks independently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, content, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100