add_action( \'widgets_init\', \'Y_widget_register\' );
你有一个拼写错误-使用下划线。
这是工件:
function Y_widget_register() {
register_sidebar(array(
\'name\' => esc_html__(\'Sidebar\', \'Y-07\'),
\'id\' => \'y-sidebar\',
\'description\' => \'Dynamic Right Sidebar\',
\'before_widget\' => \'<section id="%1$s" class="y-widget %2$s">\',
\'after_widget\' => \'</section>\',
\'before_title\' => \'<h2 class="y-widget-title">\',
\'after_title\' => \'</h2>\'
));
}
add_action(\'widgets_init\', \'Y_widget_register\');