Support

Account

Home Forums Bug Reports ACF Widgets not called/displayed on front-end in WordPress 5.9.3 Reply To: ACF Widgets not called/displayed on front-end in WordPress 5.9.3

  • This is an issue that drove my crazy twice. took me a second to remember,
    the thing is that some type of widget structure is the problem

    i have to change 2 things.

    1. your right. we must return an array inside the update
    2. we need to register the widget inside the __construct() (which is inside the class)

    // construct inside the class

        public function __construct() {
            $widget_ops = array(
                'classname' => 'cmenu_widget',
                'description' => 'Custom menu widget built with ACF Pro',
            );
            parent::__construct( 'acf_cmenu_widget', 'ACF Custom Menu Widget', $widget_ops );
    
            add_action( 'widgets_init', function() {
                register_widget( 'AcfCMenuWIdget' );
            });
        }

    and after that class just call it like so
    $someClassVar = new someClassName();