You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
After creating repeater fields locally and pushing the entire database to a staging environment, the fields appear empty on the frontend. However, these fields are visible and populated in the backend. Manually rearranging a repeater field and saving causes the values to display correctly on the frontend. Code example below.
Steps to Reproduce:
Create repeater fields locally using StoutLogic's acf-builder.
Push the local database to a staging environment.
Check the frontend in the staging environment; repeater fields appear empty.
Make a change to the repeater fields in the backend (e.g., rearrange items) and save.
Frontend now displays the repeater fields correctly.
Expected Behavior:
Repeater fields should retain and display their values on the frontend after the database is pushed to staging without requiring any modifications.
Actual Behavior:
Repeater fields are initially empty on the frontend after pushing the database to staging and require a backend modification to display correctly.
Additional Information:
<?php
namespace Kitchen\Blocks;
use StoutLogic\AcfBuilder\FieldsBuilder;
class Kitchen_Image {
const BLOCK_SLUG = 'kitchen-image';
const BLOCK_NAME = 'Kitchen Image';
public function init(){
$this->add_fields();
}
public function add_fields(){
add_action('acf/init', function() use($fields){
if(function_exists('acf_add_local_field_group')) {
acf_add_local_field_group($fields->build());
}
});
}
public function register_fields() {
$section = new FieldsBuilder('section-' . sanitize_title(__FILE__)); // get filename, slugify and lowercase and append it to section
$section
->addRepeater('images', ['max' => 5])
->addImage('image', ['return_format' => 'id'])
->endRepeater()
->setLocation('block', '==', 'acf/' . self::get_name());
return $section;
}
public static function get_name(){
return sprintf('sw-%s', static::BLOCK_SLUG);
}
}
in functions.php
$kitchen_image = new \Kitchen\Blocks\Kitchen_Image();
$kitchen_image->init();
The text was updated successfully, but these errors were encountered:
Environment:
Description:
After creating repeater fields locally and pushing the entire database to a staging environment, the fields appear empty on the frontend. However, these fields are visible and populated in the backend. Manually rearranging a repeater field and saving causes the values to display correctly on the frontend. Code example below.
Steps to Reproduce:
Expected Behavior:
Repeater fields should retain and display their values on the frontend after the database is pushed to staging without requiring any modifications.
Actual Behavior:
Repeater fields are initially empty on the frontend after pushing the database to staging and require a backend modification to display correctly.
Additional Information:
in
functions.php
The text was updated successfully, but these errors were encountered: