First custom block added to a post renders fields in sidebar instead of main well, before save/refresh
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
Empieza por el registro de row_init_block_conveyor y su configuración mode => 'auto'; después, reproduce el caso del primer bloque en el editor de WordPress utilizando el grupo de campos ACF proporcionado. El trabajo estará terminado cuando los campos de cada bloque ACF personalizado se rendericen inline en el lienzo del editor al insertarlos por primera vez.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- PHP
- Estrellas
- 947
- Forks
- 198
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AdvancedCustomFields/acf
-
PHP 8.5: "Using null as an array offset" deprecation in ACF_Data::is() when rendering a block with empty data (local-meta.php is_request)Posiblemente ocupada @faisalahammad la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
AdvancedCustomFields/acf#1044 ·
-
is_preview was called incorrectly notice on every early get_field() since 6.8.10 (acf_revisions::acf_validate_post_id)Posiblemente ocupada @faisalahammad la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
AdvancedCustomFields/acf#1041 · 1 comentario ·
-
True / False ACF control bug on RTL layoutsPosiblemente ocupada @elicohenator la tomó hace 36 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
AdvancedCustomFields/acf#1038 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
AdvancedCustomFields/acf#1034 · 3 comentarios ·
-
Bug: class-acf-field-icon_picker.php calls wp_get_attachment_image_url() with string Dashicon slug, causing fatal TypeError on PHP 8+Posiblemente ocupada @antwonw la tomó hace 47 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
AdvancedCustomFields/acf#1032 · 1 comentario ·
Todos los issues de AdvancedCustomFields/acf
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
woocommerce/woocommerce-paypal-payments#4838 ·
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
nunomaduro/dev-null.sh#1161 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100