A wordpress website with the advanced custom fields plugin installed. There is a need to create your own widget, which include some fields from advanced custom fields . I create a widget in this way, including arbitrary fields in it (image output)
class CustomWidget extends WP_Widget { function __construct() { parent::__construct( 'custom_widget', // Base ID __('CustomWidget', 'text_domain'), // Name array( 'description' => __( 'Some CustomWidget', 'text_domain' ), ) ); } // widget actual processes public function widget( $args, $instance ) { echo "<p>custom widget appear</p>"; echo "<p>". the_field('widget_banner') . "</p>"; } // outputs the content of the widget public function form( $instance ) {} // outputs the options form on admin public function update( $new_instance, $old_instance ) {} // processes widget options to be saved } // register Foo_Widget widget function register_foo_widget() { register_widget( 'CustomWidget' ); } add_action( 'widgets_init', 'register_foo_widget' ); the line custom widget appear is displayed, but the arbitrary field the_field('widget_banner') does not exist, although it is in the admin area, I fill it in and click save, and it is saved
I am doing a pattern on the forum , but the guys in the comments have the same problem
This is what argues in the frontend
array(10) { ["name"]=> string(14) "Виджеты" ["id"]=> string(9) "sidebar-1" ["description"]=> string(36) "Добавьте сюда блоки" ["class"]=> string(0) "" ["before_widget"]=> string(64) " " ["after_widget"]=> string(8) " " ["before_title"]=> string(4) " " ["after_title"]=> string(5) " " ["widget_id"]=> string(15) "custom_widget-2" ["widget_name"]=> string(12) "CustomWidget" } 

