March 2020
Beginner
660 pages
18h 28m
English
So far, we've looked at the process of creating custom widget areas and displaying them on specific templates. However, there may be situations where we need to remove the widget areas that are generated by our theme or plugins based on the requirements of our sites. In such cases, we can use the unregister_sidebar function to remove existing widget areas:
function remove_some_widgets(){ unregister_sidebar( 'sidebar-1' );}add_action( 'widgets_init', 'remove_some_widgets', 11 );
Once again, we use the widgets_init action to call a custom function. Then, we use the unregister_sidebar function to remove the default widget area of the Twenty Twenty theme by passing the unique ID of that widget area. Once this code has been added ...
Read now
Unlock full access