First, I’ll assume that you have custom nav menus properly configured:
register_nav_menus()infunctions.php, to definetheme_locationvalueswp_nav_menu()calls in the template, withtheme_locationcalled in the args array- Custom nav menus defined in the admin
- Custom nav menu(s) assigned to Theme Locations
If that’s the case, then the issue is that you’re using the wrong filter. The wp_page_menu_args filter is applied inside of wp_page_menu(), which is the default callback for wp_nav_menu() when no menu is assigned to the indicated theme_location.
The output of wp_nav_menu() applies its own filter: wp_nav_menu_args. So you’ll need to hook your callback into that filter as well:
function home_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'home_page_menu_args' );
// Hook into wp_nav_menu
add_filter( 'wp_nav_menu_args', 'home_page_menu_args' );
That way, the show_home arg will return true for both wp_page_menu() output and for wp_nav_menu() output.
Be careful with wp_nav_menu(), though; if the user adds a home link to the custom menu, then two home page links will be displayed in the rendered menu.