AdvancedCustomFields / AdvancedCustomFields/acf
First custom block added to a post renders fields in sidebar instead of main well, before save/refresh
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When inserting a custom ACF block into a post that contains no other custom ACF blocks, the block's fields render in the right-rail Block panel instead of inline in the editor canvas. All subsequently added blocks (of any ACF block type) render correctly in the canvas. The affected block also renders correctly after refreshing the page.
To reproduce
Open any post that contains no custom ACF blocks
Insert a custom ACF block (that was registered with 'mode' => 'auto')
Observe that block fields render in the right-rail Block panel, not in the editor canvas
Insert any second custom ACF block
Observe that the second block's fields render correctly in the editor canvas
Refresh the page — the first block now also renders correctly
The behavior is the same across block types: whichever block is inserted first exhibits the bug, regardless of type.
Expected behavior
All custom ACF block fields render in the editor canvas, consistently, on first insertion.
Screenshots or Video
first custom block in post:
same block added second:
Code
<?php
/**
* Conveyor Gallery Block
*/
add_action('acf/init', 'row_init_block_conveyor');
function row_init_block_conveyor() {
if( function_exists('acf_register_block_type') ) {
acf_register_block_type(array(
'name' => 'conveyor-gallery',
'title' => __('Conveyor Gallery'),
'description' => __('Insert scrolling text / sticky image gallery.'),
'render_template' => 'admin/blocks/templates/conveyor-gallery-tpl.php',
'category' => 'media',
'icon' => 'id',
'keywords' => array('conveyor', 'gallery', 'sift', 'sticky', 'scrolly'),
'supports' => array(
'color' => array(
'text' => false,
'background' => true,
'gradients' => false
),
),
'mode' => 'auto'
));
}
}
if( function_exists('acf_add_local_field_group') ):
$text_size_field = array(
'key' => 'field_block_dd_1100',
'label' => 'Text Size',
'name' => 'text_size',
'type' => 'button_group',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'choices' => array(
'medium' => 'Medium',
'large' => 'Large',
'xlarge' => 'X-Large',
),
'allow_null' => 0,
'default_value' => 'medium',
'layout' => 'horizontal',
'return_format' => 'value'
);
$text_align_field = array(
'key' => 'field_block_dd_1400',
'label' => 'Text Alignment',
'name' => 'text_alignment',
'type' => 'button_group',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'choices' => array(
'left' => 'Left',
'right' => 'Right',
'center' => 'Center',
),
'allow_null' => 0,
'default_value' => 'center',
'layout' => 'horizontal',
'return_format' => 'value'
);
$text_background_field = array(
'key' => 'field_block_dd_1200',
'label' => 'Text Background',
'name' => 'text_background',
'type' => 'true_false',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'message' => '',
'default_value' => 0,
'ui' => 1,
'ui_on_text' => 'On',
'ui_off_text' => 'Off'
);
$background_color_field = array(
'key' => 'field_block_dd_1300',
'label' => 'Background Color',
'name' => 'screen_background',
'type' => 'button_group',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'choices' => array(
'black' => 'Black',
'grey' => 'Grey',
'body' => 'Body',
),
'allow_null' => 0,
'default_value' => '',
'layout' => 'horizontal',
'return_format' => 'value'
);
$media_type_field = array(
'key' => 'field_block_dd_2100',
'label' => 'Media',
'name' => 'media',
'type' => 'button_group',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'choices' => array(
'image' => 'Image',
'video' => 'Video',
),
'allow_null' => 0,
'default_value' => 'image',
'layout' => 'horizontal',
'return_format' => 'value'
);
$img_field = array(
'key' => 'field_block_dd_2200',
'label' => 'Image',
'name' => 'image',
'type' => 'image',
'instructions' => '',
'required' => 1,
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'image',
),
),
),
'return_format' => 'array',
'preview_size' => 'thumbnail',
'library' => 'all'
);
$mobile_img_field = array(
'key' => 'field_block_dd_2300',
'label' => 'Mobile Image',
'name' => 'mobile_image',
'type' => 'image',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'image',
),
),
),
'return_format' => 'array',
'preview_size' => 'thumbnail',
'library' => 'all'
);
$video_type_field = array(
'key' => 'field_block_dd_2400',
'label' => 'Video Source',
'name' => 'video_source',
'type' => 'button_group',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'video',
),
),
),
'choices' => array(
'vimeo' => 'Vimeo',
'wordpress' => 'WordPress',
),
'allow_null' => 0,
'default_value' => 'vimeo',
'layout' => 'horizontal',
'return_format' => 'value',
);
$landscape_vimeo_field = array(
'key' => 'field_block_dd_2500',
'label' => 'Landscape Video',
'name' => 'landscape_video_vimeo',
'type' => 'url',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'video',
),
array(
'field' => 'field_block_dd_2400',
'operator' => '==',
'value' => 'vimeo',
),
),
),
'default_value' => '',
'placeholder' => ''
);
$landscape_vimeo_ratio_field = array(
'key' => 'field_block_dd_2550',
'label' => 'Aspect Ratio',
'name' => 'landscape_vimeo_aspect_ratio',
'type' => 'select',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'16x9' => '16:9',
'4x3' => '4:3',
'1x1' => '1:1',
),
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'video',
),
array(
'field' => 'field_block_dd_2400',
'operator' => '==',
'value' => 'vimeo',
),
array(
'field' => 'field_block_dd_2500',
'operator' => '!=',
'value' => '',
),
),
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => ''
);
$portrait_vimeo_field = array(
'key' => 'field_block_dd_2600',
'label' => 'Portrait Video',
'name' => 'portrait_video_vimeo',
'type' => 'url',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'video',
),
array(
'field' => 'field_block_dd_2400',
'operator' => '==',
'value' => 'vimeo',
),
),
),
'default_value' => '',
'placeholder' => ''
);
$portrait_vimeo_ratio_field = array(
'key' => 'field_block_dd_2650',
'label' => 'Aspect Ratio',
'name' => 'portrait_vimeo_aspect_ratio',
'type' => 'select',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'9x16' => '9:16',
'6x13' => '6:13',
'4x5' => '4:5'
),
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'video',
),
array(
'field' => 'field_block_dd_2400',
'operator' => '==',
'value' => 'vimeo',
),
array(
'field' => 'field_block_dd_2600',
'operator' => '!=',
'value' => '',
),
),
),
'default_value' => false,
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => ''
);
$landscape_wp_field = array(
'key' => 'field_block_dd_2700',
'label' => 'Landscape Video',
'name' => 'landscape_video_wordpress',
'type' => 'file',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'video',
),
array(
'field' => 'field_block_dd_2400',
'operator' => '==',
'value' => 'wordpress',
),
),
),
'return_format' => 'array',
'library' => 'all',
'min_size' => '',
'max_size' => '',
'mime_types' => 'mp4'
);
$portrait_wp_field = array(
'key' => 'field_block_dd_2800',
'label' => 'Portrait Video',
'name' => 'portrait_video_wordpress',
'type' => 'file',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_block_dd_2100',
'operator' => '==',
'value' => 'video',
),
array(
'field' => 'field_block_dd_2400',
'operator' => '==',
'value' => 'wordpress',
),
),
),
'return_format' => 'array',
'library' => 'all',
'min_size' => '',
'max_size' => '',
'mime_types' => 'mp4'
);
$text_field = array(
'key' => 'field_block_dd_2900',
'label' => 'Text',
'name' => 'text',
'type' => 'textarea',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'maxlength' => ''
);
acf_add_local_field_group(array(
'key' => 'group_100e1000e1000',
'title' => 'Conveyor Gallery',
'fields' => array(
array(
'key' => 'field_block_dd_1000',
'label' => 'Appearance',
'name' => 'appearance',
'type' => 'group',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'layout' => 'row',
'sub_fields' => array(
$text_size_field,
$text_align_field,
$text_background_field,
$background_color_field,
),
),
array(
'key' => 'field_block_dd_2000',
'label' => 'Screens',
'name' => 'screens',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'collapsed' => 'field_block_dd_2900',
'min' => 2,
'max' => 0,
'layout' => 'row',
'button_label' => 'Add Screen',
'sub_fields' => array(
$media_type_field,
$img_field,
$mobile_img_field,
$video_type_field,
$landscape_vimeo_field,
$landscape_vimeo_ratio_field,
$portrait_vimeo_field,
$portrait_vimeo_ratio_field,
$landscape_wp_field,
$portrait_wp_field,
$text_field,
),
),
),
'location' => array(
array(
array(
'param' => 'block',
'operator' => '==',
'value' => 'acf/conveyor-gallery',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => ''
));
endif;
Version Information
WordPress Version: 7.0.1
PHP Version: 8.3.17
ACF Version: ACF PRO 6.8.6
Browser: Google Chrome v149
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 row_init_block_conveyor registration and its mode => 'auto' setting, then reproduce the first-block case in the WordPress editor using the supplied ACF field group. Compare the first inserted custom block with a second block and with the refreshed post. Done means every custom ACF block's fields render inline in the editor canvas on first insertion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100