Skip to content

Fix – Blocks registered via acf_register_block_type() with a parent value of null no longer fail to register #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Jun 18, 2025

What

If you register a block like this one.

add_action('acf/init', 'my_acf_blocks_init');
function my_acf_blocks_init() {

    // Check function exists.
    if( function_exists('acf_register_block_type') ) {

        // Register a testimonial block.
        acf_register_block_type(array(
            'name'              => 'testimonial',
            'title'             => __('Testimonial 2'),
            'description'       => __('A custom testimonial block. 2'),
            'render_callback'   => function(){ echo 'hello from plugin';},
            'category'          => 'formatting',
	    'parent' => null
        ));
    }
}

Without the PR you get:
Screenshot 2025-06-19 at 14 46 31

Applying the patch you get the block as expected.
Screenshot 2025-06-19 at 14 47 09

@ockham ockham self-assigned this Jun 18, 2025
@cbravobernal cbravobernal added this to the 6.5.0 milestone Jun 19, 2025
@cbravobernal cbravobernal self-requested a review June 19, 2025 12:45
@cbravobernal cbravobernal marked this pull request as ready for review June 19, 2025 12:45
@cbravobernal
Copy link
Contributor

Works as expected.

@cbravobernal cbravobernal merged commit c418227 into trunk Jun 19, 2025
5 checks passed
@ockham ockham deleted the fix/register-block-with-null-parent branch June 19, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants