WP 4.3 中的小部件消失 - 如何修复?
Widgets in WP 4.3 disappearing - How to fix?
我定义了我的小部件,如下面的代码所示。自从更新 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');
这是 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 ) ) {
我定义了我的小部件,如下面的代码所示。自从更新 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');
这是 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 ) ) {