Support

Account

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

Solving

ACF Widgets not called/displayed on front-end in WordPress 5.9.3

  • ACF widget content was being displayed fine, but after updating to 5.9.3 nothing is displayed on the front-end.

    It still works in the admin and allows field values to be saved etc. (using Classic Widgets plugin)

    I have noticed that the function IS called when viewing front-end via Appearance > Customizer

    ACF Pro 5.12.2

  • Hello benw,
    Have the same situation here. After updating to 5.9.3 widgets are gone in the front-end. In the admin panel everything seems right, fields widget are displayed, and values can also be saved and updated.
    Were you able to find out what was the cause and fix the problem?

    ACF PRO 5.12.2

  • Hey guys,

    I had the same problem; all my custom widgets were missing from the front-end after updating WP (with gutenberg disabled) but they were still showing up fine in the dashboard

    After some trial and error I managed to get them working — In the widget class, the update function needed to return an array, and then I needed to re-add the widgets and save them again in the dashboard.

     public function form( $instance ) {
      }
    
      public function update( $new_instance, $old_instance ) {
        $instance = array();
        return $instance;
      }
    
  • 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();

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.