Design Wordpress

WordPress | Front page displays > Your latest posts – Home Page Link

While creating a WordPress website, I ended up wanting to put a home page link on the far left side of my menu bar. The only problem was that if I created a Home page, meaning, it would NOT re-direct to like I wanted it to.

As you can see, my Reading Setting for my Front Page display is set to Your latest posts.

The first thing I did was delete my Home page that I created. Here’s where the magic comes into play. All you have to do is append the following code into your functions.php file.

add_filter( 'wp_nav_menu_items', 'add_home_link', 10, 2 );
function add_home_link($items, $args) {
 if (is_front_page())
 $class = 'class="current_page_item"';
 $class = '';
 $homeMenuItem =
 '<li ' . $class . '>' .
 $args->before .
 '<a href="' . home_url( '/' ) . '" title="Home">' .
 $args->link_before . 'Home' . $args->link_after .
 '</a>' .
 $args->after .
 $items = $homeMenuItem . $items;
 return $items;

This will then create a Home link on your top menu bar that links to



By Tommy Elmesewdy

DevOps Engineer

1 reply on “WordPress | Front page displays > Your latest posts – Home Page Link”