Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Hide the Sidebar on Your WordPress Home Page

Last updated on by
Follow WPBeginner on YouTube
How to Hide the Sidebar on Your WordPress Home Page

As you probably have noticed that most WordPress blogs have the same sidebar on all blog pages. While sidebar is important, sometimes it is not necessary for the homepage. In this article, we will share how you can hide the sidebar on your WordPress homepage.

One of the ways to do is by creating a completely new custom homepage for your WordPress blog, or you can simply make the change by using the code from this tutorial.

First open your index.php and locate the following code:

<?php get_sidebar(); ?>

Then Replace the code with:

<?php if (!is_front_page()) {
} ?>

And thats it. Now your Front Page will not have the sidebar.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Livi says:

    Visit number three to your site in the last 2 hours. HAD to subscribe. Worked perfectly.

  2. Sandeep says:

    Wow that is just what I was looking for…

  3. Zack says:

    After following your tutorial, the homepage sidebar gone, but the text of post are doesn’t fit to the page. why?

  4. Donna says:

    Not sure what I did wrong, but sidebar is still on the homepage

  5. Ma Ke says:

    It doesn’t work in my blog. When I entered the index.php, site stats etc appeared. No codes. Any help?

  6. Tomi says:

    Thank you very much!!!
    It worked perfect!!!!

  7. Scott says:

    Thanks! Just what I was looking for, and worked as advertised.

  8. Lucas Raby says:

    What if you want to hide it on the contact page rather than the homepage…? Thanks.

  9. Milky Media says:

    Just wanted to add on this that I’ve been finding the ‘get_sidebar’ code in the footer.php.

    If you can’t find it in index.php, try there.

  10. Junaid says:

    Nice and simple hack! Saved me some other theme modification that i feared would mess up things :)

  11. Geekyard says:

    Great Hack buddy :) Works fine ;)

  12. Dario Gutierrez says:

    Great tip dude! Thanks

  13. joyoge bookmark says:

    thanks for the tip..

  14. Alex Duvot says:

    thanks for the tip
    going to try this now

  15. alaJoAnn says:

    Your instructions are a timely find. I just set up a static homepage and figured out how to remove the first code (and things looked right).

    Now I have pasted in the replacement code. I’m not a coder, but I bet doing that will avoid problems down the road.

    I shared this fix with my fellow PrimePress theme users at our support forum.

    • jmw456 says:


      When I opened up my index.php file, the code didn’t actually have the bit you stated above. It only had the following text. Could you tell me which bit to replace here?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.