Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get linksbyname

This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use any of these functions instead.


Like wp_get_linksbyname(), this tag displays links from the Links Manager, but allows the user to control how they are displayed by tag parameters, rather than through the WordPress admin interface (useful when displaying links on more than one template).

Replace With



 <?php get_linksbyname('cat_name''before'
show_updated); ?> 


Default Usage

By default, the tag shows:

  • All categories if none are specified
  • All category links are shown
  • Puts a line break after the link item
  • Puts a space between the image and link (if one is included)
  • Shows link images if available
  • List sorted by ID
  • Shows the link description
  • Does not show the rating
  • With no limit listed, it shows all links
  • Does not show the updated timestamp
<?php get_linksbyname(); ?>

Specific Category Sorted by Name

Displays links for link category "Friends" in an unordered list with descriptions on the next line, sorts by link name.

<?php get_linksbyname('Friends', '<li>', '</li>', '<br />', FALSE, 
'name', TRUE); ?>

With Images and Ratings, No Descriptions

Displays all links one per line without descriptions, uses images for links, sorts by link name, and shows ratings.

<?php get_linksbyname('', '', '<br />', '', TRUE, 'name', FALSE, TRUE); ?>

As a Definition List with Images and Descriptions in Separate Tags

Displays all links in a Definition List, places linked images in the <dt>, descriptions in the <dd>, and sorts by rating but doesn't show it.

  <?php get_linksbyname('Portfolio', '<dt>',
       '</dd>','</dt><dd>', TRUE, 'rating',
       TRUE, FALSE, -1, FALSE); ?> 

To see examples of styling this markup in a fluid/elastic, multi-column layout with backgrounds and hover effects, please see Manipulating Definition Lists for Fun and Profit.


(string) The name of the link category whose links will be displayed. If none is specified, all links are shown. Defaults to 'noname' (all links).
(string) Text to place before each link. There is no default.
(string) Text to place after each link. Defaults to '<br />'.
(string) Text to place between each link/image and its description. Defaults to ' ' (space).
(boolean) Should images for links be shown (TRUE) or not (FALSE). Defaults to TRUE.
(string) Value to sort links on. Defaults to 'id'. Valid options:
  • 'id'
  • 'url'
  • 'name'
  • 'target'
  • 'category'
  • 'description'
  • 'owner' - User who added link through Links Manager.
  • 'rating'
  • 'updated'
  • 'rel' - Link relationship (XFN).
  • 'notes'
  • 'rss'
  • 'length' - The length of the link name, shortest to longest.
Prefixing any of the above options with an underscore (ex: '_id') sorts links in reverse order.
  • 'rand' - Display links in random order.
(boolean) Display the description (TRUE) or not (FALSE). Valid if show_images is FALSE or an image is not defined. Defaults to TRUE.
(boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE.
(integer) Maximum number of links to display. Defaults to -1 (all links).
(boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE.


get_bookmark(), get_bookmark_field(), get_bookmarks(), wp_list_bookmarks()

See also index of Function Reference and index of Template Tags.