Opened 11 years ago
Closed 11 years ago
#30800 closed defect (bug) (invalid)
Twenty Fourteen does not set priority for sidebars
| Reported by: |
|
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
@
11 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
#4
follow-up:
↓ 5
@
11 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
@
11 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) orremove_action( 'widgets_init', 'twentyfourteen_widgets_init', 10 )(to be explicit).
This doesn't work. The sidebar is still there.
#6
@
11 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
@
11 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
@
11 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/.
#30805 was marked as a duplicate.