AdvancedCustomFields / AdvancedCustomFields/acf
Bug with acf-innerblocks-container and wp_get_attachment_image()
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
I'm using ACF 6.0.0-alpha4 and the block.json approach for blocks (see #654 ).
If you have a block with <InnerBlocks />, it will be wrapped in a .acf-innerblocks-container div on both the frontend and backend (expected behavior).

If you include a div with wp_get_attachment_image() after your InnerBlocks, the .acf-innerblocks-container class changes to the following div's class on the frontend only.
echo '<InnerBlocks />';
echo '<div class="testing">' . wp_get_attachment_image( 213, 'thumbnail' ) . '</div>';

Manually specifying a class for the InnerBlocks seems to fix this:
echo '<InnerBlocks class="my-custom-class" />';
echo '<div class="testing">' . wp_get_attachment_image( 213, 'thumbnail' ) . '</div>';

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
Reproduce this with ACF 6.0.0-alpha4 using the block.json approach, a block containing InnerBlocks, and the following wp_get_attachment_image() div. Compare the generated wrapper markup on the frontend and backend, including the case with and without an explicit InnerBlocks class. Done means the .acf-innerblocks-container class remains correct on the frontend while the image is rendered afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100