WordPress Snippets at WPcustoms

Add link to top 5 authors in nav menu

This snippet adds a link to your top 5 authors ranked by post count. The code gets added to your navigation registered with ‘header-navigation’


/**
 * Snippet Name: Add link to top 5 authors in nav menu
 * Snippet URL: https://wpcustoms.net/snippets/add-link-to-top-5-authors-in-nav-menu/
 */
  function wpc_top_authors($items, $args){
    if( $args->theme_location == 'header-navigation' )
        return $items . '
  • Top 5 Authors
  • '; } add_filter('wp_nav_menu_items','wpc_top_authors', 10, 2);