Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#30800 closed defect (bug) (invalid)

Twenty Fourteen does not set priority for sidebars

Reported by: wpmudev-support6's profile WPMUDEV-Support6 Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Bundled Theme Keywords:
Focuses: Cc:

Description

The summary pretty much sums the problem. :)

This might be a bug, or might be left there intentionally, but I doubt it.

In short people can't unregister sidebars from their child themes.
I know this is not the place for this, but I do not have permissions here - https://themes.trac.wordpress.org/newticket

It is on line 198 in functions.php

add_action( 'widgets_init', 'twentyfourteen_widgets_init' );

and should be something like this:

add_action( 'widgets_init', 'twentyfourteen_widgets_init', 10 );

Change History (8)

#1 @WPMUDEV-Support6
10 years ago

  • Severity changed from normal to minor
  • Summary changed from Twenty Forteen does not set priority for sidebars to Twenty Fourteen does not set priority for sidebars

#2 @ocean90
10 years ago

#30805 was marked as a duplicate.

#3 @ocean90
10 years ago

  • Component changed from Themes to Bundled Theme

#4 follow-up: @nacin
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

All hooks have a priority. The default is 10. add_action( 'widgets_init', 'twentyfourteen_widgets_init' ); sets priority to 10. To remove this, you simply call remove_action( 'widgets_init', 'twentyfourteen_widgets_init' ) (when priority is 10) or remove_action( 'widgets_init', 'twentyfourteen_widgets_init', 10 ) (to be explicit).

#5 in reply to: ↑ 4 @fmarzocca
9 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to nacin:

To remove this, you simply call remove_action( 'widgets_init', 'twentyfourteen_widgets_init' ) (when priority is 10) or remove_action( 'widgets_init', 'twentyfourteen_widgets_init', 10 ) (to be explicit).

This doesn't work. The sidebar is still there.

#6 @dd32
9 years ago

The duplicate ticket had this extra information:

What all that means is that my code being in child theme is called before the code in the main theme functions.php and I unregister the sidebar, but then the main theme register it.
There is no priority I could assign to my unregister_sidebar as in this case it is missing in the parent theme.

The remove_action call will need to be made during the after_setup_theme hook to work.

#7 @fmarzocca
9 years ago

Still no luck with the following code. Could it be a matter of priority?

function child_function() {

	remove_action( 'widgets_init', 'twentyfourteen_widgets_init',10);
}
add_action( 'after_setup_theme', 'child_function' );

#8 @nacin
9 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

That code works for me. If you need more help, please try the support forums: https://wordpress.org/support/.

Note: See TracTickets for help on using tickets.