WordPress wp_list_bookmarks() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Prints HTML

Definition

In WordPress, wp_list_bookmarks() builds an HTML list of bookmarks (links). By default it groups them by link category, with a heading for each group.

It prints the list. Set echo to false and it returns the HTML as a string instead.

Syntax

Call it with no arguments, or pass an array to change the list.

WordPress
wp_list_bookmarks();
wp_list_bookmarks( array( 'categorize' => 0, 'title_li' => '' ) );
$html = wp_list_bookmarks( array( 'echo' => false ) );
CallWhat it does
wp_list_bookmarks()Prints all visible links, grouped by link category.
wp_list_bookmarks( array( 'categorize' => 0 ) )Prints one flat list without category headings.
$html = wp_list_bookmarks( array( 'echo' => false ) )Returns the HTML as a string. Nothing is printed.

With the default settings, the output is a set of <li> items. Wrap it in a <ul>.

Full declaration
WordPress
wp_list_bookmarks( string|array $args = '' ): void|string

Parameters

ParameterDescription
categorizeGroup links by link category. Default is 1. Use 0 for one flat list.
title_liHeading text for a flat list. Default is 'Bookmarks'. Use '' for no heading.
category / category_nameShow only links from these link category IDs or this name.
orderby / orderSort the links. Default is name and ASC.
limitMaximum number of links. Default is -1 (no limit).
show_descriptionShow the link description after the name. Default is 0.
hide_invisibleHide links marked as not visible. Default is 1.
echoPrint the list (1, default) or return it (0 or false).

You can pass the arguments as an array or as a query string such as 'categorize=0&limit=5'.

Return Value

Return ValueDescription
voidNothing is returned when echo is true. The list is printed.
stringThe HTML list when echo is false.

WordPress Examples

Three short theme examples. Each one has a sample output.

Example 1 — Default list

Print all links, grouped by link category.

WordPress
<ul>
  <?php wp_list_bookmarks(); ?>
</ul>

How It Works

  1. The default call groups links by link category.
  2. Each group gets its own <li> and heading.
  3. Our own <ul> wraps the list.

Example 2 — Flat list with descriptions

Show one category as a flat list, with no heading and with descriptions.

WordPress
<?php
wp_list_bookmarks( array(
  'category_name'    => 'Friends',
  'categorize'       => 0,
  'title_li'         => '',
  'show_description' => 1,
  'show_images'      => 0,
) );
?>

How It Works

  1. categorize => 0 makes one flat list.
  2. title_li => '' removes the heading.
  3. show_description prints the description after the name. Extra attributes such as title or rel may also appear.

Example 3 — Return the HTML

Save the list in a variable and wrap it in your own tag.

WordPress
<?php
$html = wp_list_bookmarks( array(
  'echo'        => false,
  'categorize'  => 0,
  'title_li'    => '',
  'limit'       => 2,
  'show_images' => 0,
) );

if ( $html ) {
  echo '<div class="blogroll">' . $html . '</div>';
}
?>

How It Works

  1. echo => false returns the HTML instead of printing it.
  2. limit => 2 keeps only two links.
  3. You decide where and how to print the saved HTML.

Frequently Asked Questions

It prints an HTML list of your bookmarks (links). By default the links are grouped by link category, with a heading for each group.
Set categorize to 0 and title_li to an empty string, for example wp_list_bookmarks( array( 'categorize' => 0, 'title_li' => '' ) ).
Set echo to false. The function then returns the HTML as a string, and you can print it later with echo.
The function prints nothing when no link matches. Check that you have links, that they are marked visible, and that the category name is correct. If the Links menu is missing, install the Link Manager plugin.
Use get_bookmarks() when you want full control of the HTML. Use wp_list_bookmarks() when you want WordPress to build the list for you.

Back to the Function Index

Browse all bookmark functions in one table.

Bookmark Functions Index →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful