When WordPress 3.0 was launched, many people did not know about how to add a home page link in the WordPress 3.0 Menu. The simple solution was to add home-page link as a Custom Link to the menu. Well in this article, we will show you how you can show home page link under the pages widget in WordPress 3.0 menu system. This is something that all theme developers should have in their WordPress 3.0 compatible themes.
First open your theme’s functions.php file and paste the following code:
function home_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'home_page_menu_args' );
Once you have pasted this code, It should add “Home” as an option under the “Pages” widget on the Menu management page so the user can simply check it off as an item to add to their custom menu.









Is wordpress realy this retarded? Do I have to add some hack in the core files to get a menu link to the main page? What will happen when I update wordpress to a newer version? It will certainly overwrite functions.php, and my menu item is gone.
Since WP does not seem to think that you should be able to have a menu item to your main page if it happens to be your “recent posts page”, I started to look for a plugin that solved this in a more permanent way than hacking some php files. But I could not find any. Is there really no good way to solve such a trivial thing?
You are NOT hacking the core. You are adding this code to your theme’s functions.php file.
You save my page
)
Thanks!
Thanks a lot. This was exactly what I was looking for.
Useful and working ..
Thx.
Thanks a lot, this was exactly what I need
Can I say “THANK YOU SO MUCH”!!! This was exactly what I was looking for. Fixed my website’s main nav perfectly.
I love WPBeginner!
Thank you for helping!!!! It’s really awesome.
However, if I want to set the URL of default home as
How can I do that?
Any response will be greatly appreciate.
You can just create a new custom menu item and change the URL there.
Thank you so much for this handy tip! It worked a charm first time!
GENIUS!
Thank you so much – I just spent about 4 hours trying to figure out a simple solution to this. There are many attempts out there but none actually seem to work (at least not on my Barebones installation).
This is so simple and perfect
Thanks again!
I love you man. Thank you so much
which is the best wordpress version???
ok ive found it so ignore the comment below, but it doesnt seem to work :S help! lol
@fatemusiclive If you are using WordPress.com then you won’t have that file available.
i dont seem to have a function.php file under themes editor (unless its somewhere else and ive got it wrong and u can direct me lol) can i just add it into the style sheet?
Thank you so much for posting this. I added the homepage before on another wordpress site I had created, but couldn’t remember how I did it (it was also an earlier version of wordpress too). Your post worked perfectly! thank you
SOOO glad I found this! I had no idea what I was doing and you made it so simple. THANK YOU!
just FANTASTIC man! you saved me lots of time! thank you very much!
Glad we were able to help.
Thank you – this worked great.
However … now I want to *remove* it as an option (ie back to no ‘Home’ option) but it won’t go away. I tried the following …
1) removed the code from functions.php
2) changed $args['show_home'] = true; to $args['show_home'] = false;
3) hard-refreshed the browser on the admin Menus page
4) logged out/in of wp-admin
5) copied the original functions.php back from twentyten
… but it’s still listed under “View All”
Any suggestions?
Good trick. Or one can also insert a custom link by typing website.com and then there you go
But clients who don’t understand all this, will find this trick helpful.
Yes, this generates the home page link and it is dynamic.
Does the home page link work in Wp 3.1.1?
Yes… it should work fine.
Thanks. Work great!
Somebody mentioned about if sites URL changes. I use a solitary / when linking to my home page. Don’t know if this good practice but it works.
This is great – thank you.
What happens though if the site is in development and the URL of the site changes? Will the “Home” link be automatically updated?
Is there a way to embed a shortcode into the menu item so that the home URL will always be current?
The home url value is coming from your Settings that you have set. If you change that URL, then yes it will change. You can set a custom class for home by clicking edit on the home link in the menu.
It looked simple to do, but no matter where I put that code in the theme’s function.php file, it doesn’t work.
Any clues as to why that might be?
Are you clicking on the View All tab? This code is working on a lot of our client’s sites.
Hi,
You still haven’t answered Sheila’s question – where in the Functions.php file do we place this code?
Thanks!
Sheila says:
November 11, 2010 at 11:44 am
It looked simple to do, but no matter where I put that code in the theme’s function.php file, it doesn’t work.
Any clues as to why that might be?
Reply
*
Editorial Staff says:
November 12, 2010 at 4:54 pm
Are you clicking on the View All tab? This code is working on a lot of our client’s sites.
You place this code within the php tag anywhere in the functions.php file.
Awesome, thank you so much! I was looking all over for the solution!
Thank you wpbeginner. Details like these make us more comfortable working with WordPress.
neat and easy peasey
Nice and simple trick.thank you
I love love love the articles on wpbeginner.com
Keep them coming…now I only have to switch my own website from .net to wordpress.
But for that to happen I have to build first my own plugin to submit table tennis scores.
Shouldn’t be hard to build that plugin
Let us know once you make the plugin