Skip to content

register_sidebar() don't work correctly #696

@ghost

Description

Submited widgets after refresh page, drops in unactive section.
Auto add_theme_support('widgets') don't works in register_sidebar(array)

my docker-compose build:

version: '3'

volumes:
  MYSQL_DATA:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}/db
      o: bind

  WP_DATA:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}/wordpress
      o: bind

  WP_THEME:
    driver: local
    driver_opts:
      type: none
      device: ${PWD}/themes
      o: bind

services:

  composer:
    image: composer
    container_name: composer
    volumes:
      - ./composer/composer.json:/app/composer.json
      - WP_DATA:/app:rw
    command: update

  wp:
    image: wordpress
    restart: unless-stopped
    container_name: wp
    env_file: 
      - ./env/wp.env
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_NAME: wordpress
    links:
      - db
    volumes:
      - WP_DATA:/var/www/html:rw
      - WP_THEME:/var/www/html/wp-content/themes:rw
      - ./php/php.ini:/usr/local/etc/php/php.ini:rw
    ports:
      - 80:80
    depends_on:
      - db
      - composer

  db:
    image: mariadb
    restart: unless-stopped
    container_name: db
    env_file:
      - ./env/db.env
    environment:
      MYSQL_DATABASE: wordpress
    volumes:
      - MYSQL_DATA:/var/lib/mysql:rw

  pma:
    image: phpmyadmin
    restart: unless-stopped
    container_name: pma
    links:
      - db
    ports:
      - 8081:80
    depends_on:
      - db

So problem, when i add register_sidebar with function, widgets don't show in adminbar

<?php
add_action('widgets_init', 'ju_widgets');

//from includes/widgets.php
function ju_widgets()
{
	register_sidebar([
		'name'						=>	__('Sidebar Primary', 'udemy'),
		'id'							=>	'ju_sidebar',
		'description'			=>	__('Sidebar for the theme Udemy', 'udemy'),
		'before_widget'		=>	'<div id="%1$s" class="widget clearfix %2$s">',
		'after_widget'		=>	'</div>',
		'before_title'		=>	'<h4>',
		'after_title'			=>	'</h4>'
	]);
}
?>

but when i add theme support widgets in functions.php

<?php
add_theme_support('widgets');
?>

It shows in admin bar, when i go in widgets page see block editor add widgets into Sidebar Primary submit updates. After submit changes i refresh the widgets page (current page) all my components (widgets) drops in unactive section.

I build my functions.php from few php files, i think it helps.

functions.php
|
includes/widgets.php

In php.ini i change only uploads_max_size from 2M to 50M, max_execution_time from 30 to 500, post_max_size from 2M to 50M

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions