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();
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.