WP 4.3中的小部件正在消失 - 如何修复?

时间:2015-08-28 10:03:53

标签: wordpress widget

我定义了我的小部件,如下面的代码所示。自从更新4.3 Wordpress做了一些改变我无法解决。我需要改变什么才能再次看到前端的小部件?我可以在后端小部件菜单中进行编辑和查看,但不能在前端进行编辑。

class Z_Suche extends WP_Widget {
function __construct()
{
    parent::__construct( false, $name = 'Z Suchfeld', array( 'description' => 'Suchformular im Z-Style.' ) );

}

function widget( $args, $instance )
{
    ?>
        <div class="widget" id="sidebarsearch">
            <h3>Suchen</h3>
            <?php get_search_form(); ?>
        </div>
    <?php
}

function update( $new_instance, $old_instance ) {
    $instance = array();
            return $instance;
}
function form( $instance ) {}
}
register_widget('Z_Suche');

1 个答案:

答案 0 :(得分:1)

这是WordPress 4.3中的错误。作者对核心进行了必要的修改,并将在WordPress 4.3.1中修复。

与此同时,您可以修补您的WordPress版本。详细信息如下:https://core.trac.wordpress.org/ticket/33442

基本上,在wp-includes \ widgets.php中更改第319行:

if ( isset( $instances[ $this->number ] ) ) { 

为:

if ( array_key_exists( $this->number, $instances ) ) { 
相关问题