Removing the Sidebar Links/Widgets in WordPress

remove-sidbar-links-completely-1-wordpress

When working with a WordPress theme, occasionally, the webmaster may want to completely remove the sidebar links and widgets from the theme. This can be done through the Widgets or by editing the source code of the sidebar.php file in the WordPress Appearance editor.

(Not a current customer? Click here to learn more about InMotion’s WordPress Hosting platform.)

There are several ways the sidebar widgets can be disabled. This article will explain how to completely remove the sidebar links and widgets from the bird site theme through the Widget editor and through the Appearance editor.

Removing sidebar widgets completely through the Theme editor

  1. Log into the WordPress Dashboard
  2. Navigate to Appearance > Widgets. Click here for information on removing and adding widgets.
  3. Add a blank text widget. Now the links and widgets will not display.

If for whatever reason, the widget text box is not available or does not work, the code can be commented out to remove the sidebar links and widgets. Commenting the code is good because the original source code is not changed. If the source code is changed and the site breaks, it can be difficult to remember what change broke it, Especially if the code is deleted.

Removing sidebar widgets completely through the code

Note that making any changes to the core files of a theme may be erased if the theme updated. To prevent code issues, please create a child theme.

  1. Log into the WordPress Dashboard
  2. Navigate to Appearance > Theme Editor on the left in the WordPress Dashboard.
  3. remove-sidbar-links-completely-3.-wordpressOn the Edit Themes page, select the sidebar.php page on the right hand side in the Theme Files section.
     
  4. remove-sidbar-links-completely-4-wordpressThe code for the sidebar.php will load in the Theme editor window.

    Important! Editing the source code of a WordPress theme is a critical change. If the code is not edited correctly, the site WILL break. If you are not comfortable editing the code, please check with a developer before proceeding.

     

    Add a comment to the code like in the snapshot to the right. HTML comments look like the following:
    <!-- Begin Comment
    Code goes in between here
    End Comment -->

    Add the comment code to the page in the Theme editor and Click Update File

    remove-sidbar-links-completely-5-wordpressNow when visiting the WordPress site, the sidebar will not display any widgets or links at all.

     

To learn more about Widgets, please visit What are Plugins and Widgets?

AC
Arnel Custodio Content Writer I

As a writer for InMotion Hosting, Arnel has always aimed to share helpful information and provide knowledge that will help solve problems and aid in achieving goals. He's also been active with WordPress local community groups and events since 2004.

More Articles by Arnel

33 Comments

  • Hi Laura,

    I think I understand why you’re not able to follow this. I’m having the same issue but I finally figured out why. In my case, the “theme file” didn’t actually have a “sidebar.php”

    For me, the “sidebar.php” is part of a parent theme.

  • Hello, I have tried everything on this page and still getting parsing errors? I copied the exact comment code that is pictured above in #4 and continue to get errors and a space where the sidebar was … is there exact code that works? thanks in advance

  • I used this method and the sidebar is removed, BUT the things that went to the sidebar went to the bottom of the page. How can I fix this?

  • Why even bother removing the Sidebar? Just find a theme that doesn’t use one. Oh wait, that’s impossible 99.9% of themes have sidebars, they’re quite annoying especially when you want to add character sheets from a game that I play. Personally, I have a hard time understand the instructions even given showing images on how.. I just still don’t get the flipping point. But, then again I am slow at things and it takes a bit for me to understand something that appears so simple. *Sighs* I Need a FULL-Width Theme with Header and Footer ONLY no side bar stuff.

    Laura the frustrated.

     

    • I’m sorry to see about you being frustrated, Laura, I can definitely understand! Which step are you experiencing an issue with? We are happy to assist further or update the guide to be more helpful!

    • To do that you would need to create a separate page template in the theme that does not have the sidebar and assign that template to the page you do not want it to display on.

    • Our apologies, I modified the article so that the code would be displayed properly. I hope this helps!

    • Are you experiencing an issue following the instructions here for removing the sidebar? If so, can you please elaborate on the steps you are taking and what errors you are receiving?

  • I want to hide sidebar from the specific post on my blog https://vijaybhabhor.com/marketing/conversions/wordpress-plugins/, please let me know is there any way to hide this?

    • Removing the sidebar for a specific post will require some coding. The WordPress community has provided various answers for this in this particular forum. Check out the solutions and see which works best for you.

  • This is not working on my themes 

    please give another way to remove sidebar on my thmes

    i am not a good php devloper that for you shoud simple answar to me

     

    • Here is a helpful post from the official WordPress forums, where they discuss additional ways to remove the sidebar.

      Thank you,
      John-Paul

  • After removing the sidebar, you may remove the space it was in by adjusting the child theme settings.

    In the dashboard go to Child Theme > Settings > Layout and change the ‘main layout’ to the first box, so click the box that has no gray inside of it, indicating no columns on all pages. 

     

  • Thank you very much. I am not very experienced with php and things, but I managed to get rid of the thing. Excellent.

    • There may be a preferred method suggested by the plugin vendor. I suggest you contact them for more information. This article covers how to remove the widget area.

  • OK, so now there’s no content IN the sidebar, but there’s still space for it. How do I make the space go away and the text part move to the center of the page?

    • Removing the content does not change the structure of the theme. It still will contain the column, although empty. To change that you would either need to modify the theme code or find another theme that does not have that column.

Was this article helpful? Let us know!