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
Special WordPress Hosting offer for WPBeginner Readers
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. Mandy says:

    Hi, thank you so so so much! I’ve been trying all sorts of codes/css modification for days, and finally came across your page and it works! I have finally removed the sidebar on home page, with other pages unaffected, like I intend them to.

    I do wish the front page content can be expanded to fill out the removed sidebar. Do you have a code that helps?


  2. Livi says:

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

  3. Sandeep says:

    Wow that is just what I was looking for…

  4. Zack says:

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

  5. Donna says:

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

  6. Ma Ke says:

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

  7. Tomi says:

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

  8. Scott says:

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

  9. Lucas Raby says:

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

  10. 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.

  11. Junaid says:

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

  12. Geekyard says:

    Great Hack buddy :) Works fine ;)

  13. Dario Gutierrez says:

    Great tip dude! Thanks

  14. joyoge bookmark says:

    thanks for the tip..

  15. Alex Duvot says:

    thanks for the tip
    going to try this now

  16. 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.