Remove Widgets from Your WordPress theme

  1. Home
  2. Knowledge Base
  3. WordPress Themes
  4. Remove Widgets from Your WordPress theme

So you want to remove some of the stock Widget Areas from the WordPress theme, how do you go about doing this? For example we use Twenty Ten Theme, We will be using the WordPress function unregister_sidebar(). It is accomplished with a few lines of code in your Twenty Ten child theme’s functions.php file. You are using a child theme, aren’t you?

First define a new function, we used remove_widget_area(). Inside this function we un-register the desired stock Widget Areas we dont want or need. Twenty Ten comes with the following stock Widget Areas: primary-widget-area, secondary-widget-area, first-footer-widget-area, second-footer-widget-area, third-footer-widget-area and fourth-footer-widget-area.

We then initiate the new remove_widget_area() function using the add_action() WordPress function as shown below.

Putting it all together yields the following code to be placed in your themes functions.php file:

Its just that simple, now its your turn!

Was this article helpful?

Related Articles

Leave a Reply