get_links_list

The timeline below displays how wordpress function get_links_list has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Output entire list of links by category.
 *
 * Output a list of all links, listed by category, using the settings in
 * $wpdb->linkcategories and output it as a nested HTML unordered list.
 *
 * @since 1.0.1
 * @deprecated 2.1.0 Use wp_list_bookmarks()
 * @see wp_list_bookmarks()
 *
 * @param string $order Sort link categories by 'name' or 'id'
 */
function get_links_list($order = 'name')
{
    _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
    $order = strtolower($order);
    // Handle link category sorting.
    $direction = 'ASC';
    if (str_starts_with($order, '_')) {
        $direction = 'DESC';
        $order = substr($order, 1);
    }
    if (!isset($direction)) {
        $direction = '';
    }
    $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
    // Display each category.
    if ($cats) {
        foreach ((array) $cats as $cat) {
            // Handle each category.
            // Display the category name.
            echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name) . "</h2>\n\t<ul>\n";
            // Call get_links() with all the appropriate params.
            get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
            // Close the last category.
            echo "\n\t</ul>\n</li>\n";
        }
    }
}

WordPress Version: 5.4

/**
 * Output entire list of links by category.
 *
 * Output a list of all links, listed by category, using the settings in
 * $wpdb->linkcategories and output it as a nested HTML unordered list.
 *
 * @since 1.0.1
 * @deprecated 2.1.0 Use wp_list_bookmarks()
 * @see wp_list_bookmarks()
 *
 * @param string $order Sort link categories by 'name' or 'id'
 */
function get_links_list($order = 'name')
{
    _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
    $order = strtolower($order);
    // Handle link category sorting.
    $direction = 'ASC';
    if ('_' == substr($order, 0, 1)) {
        $direction = 'DESC';
        $order = substr($order, 1);
    }
    if (!isset($direction)) {
        $direction = '';
    }
    $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
    // Display each category.
    if ($cats) {
        foreach ((array) $cats as $cat) {
            // Handle each category.
            // Display the category name.
            echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name) . "</h2>\n\t<ul>\n";
            // Call get_links() with all the appropriate params.
            get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
            // Close the last category.
            echo "\n\t</ul>\n</li>\n";
        }
    }
}

WordPress Version: 4.6

/**
 * Output entire list of links by category.
 *
 * Output a list of all links, listed by category, using the settings in
 * $wpdb->linkcategories and output it as a nested HTML unordered list.
 *
 * @since 1.0.1
 * @deprecated 2.1.0 Use wp_list_bookmarks()
 * @see wp_list_bookmarks()
 *
 * @param string $order Sort link categories by 'name' or 'id'
 */
function get_links_list($order = 'name')
{
    _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
    $order = strtolower($order);
    // Handle link category sorting
    $direction = 'ASC';
    if ('_' == substr($order, 0, 1)) {
        $direction = 'DESC';
        $order = substr($order, 1);
    }
    if (!isset($direction)) {
        $direction = '';
    }
    $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
    // Display each category
    if ($cats) {
        foreach ((array) $cats as $cat) {
            // Handle each category.
            // Display the category name
            echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name) . "</h2>\n\t<ul>\n";
            // Call get_links() with all the appropriate params
            get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
            // Close the last category
            echo "\n\t</ul>\n</li>\n";
        }
    }
}

WordPress Version: 4.4

/**
 * Output entire list of links by category.
 *
 * Output a list of all links, listed by category, using the settings in
 * $wpdb->linkcategories and output it as a nested HTML unordered list.
 *
 * @since 1.0.1
 * @deprecated 2.1.0 Use wp_list_bookmarks()
 * @see wp_list_bookmarks()
 *
 * @param string $order Sort link categories by 'name' or 'id'
 */
function get_links_list($order = 'name')
{
    _deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()');
    $order = strtolower($order);
    // Handle link category sorting
    $direction = 'ASC';
    if ('_' == substr($order, 0, 1)) {
        $direction = 'DESC';
        $order = substr($order, 1);
    }
    if (!isset($direction)) {
        $direction = '';
    }
    $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
    // Display each category
    if ($cats) {
        foreach ((array) $cats as $cat) {
            // Handle each category.
            // Display the category name
            echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name) . "</h2>\n\t<ul>\n";
            // Call get_links() with all the appropriate params
            get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
            // Close the last category
            echo "\n\t</ul>\n</li>\n";
        }
    }
}

WordPress Version: 3.9

/**
 * Output entire list of links by category.
 *
 * Output a list of all links, listed by category, using the settings in
 * $wpdb->linkcategories and output it as a nested HTML unordered list.
 *
 * @since 1.0.1
 * @deprecated 2.1.0
 * @deprecated Use wp_list_bookmarks()
 * @see wp_list_bookmarks()
 *
 * @param string $order Sort link categories by 'name' or 'id'
 */
function get_links_list($order = 'name')
{
    _deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()');
    $order = strtolower($order);
    // Handle link category sorting
    $direction = 'ASC';
    if ('_' == substr($order, 0, 1)) {
        $direction = 'DESC';
        $order = substr($order, 1);
    }
    if (!isset($direction)) {
        $direction = '';
    }
    $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
    // Display each category
    if ($cats) {
        foreach ((array) $cats as $cat) {
            // Handle each category.
            // Display the category name
            echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name) . "</h2>\n\t<ul>\n";
            // Call get_links() with all the appropriate params
            get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
            // Close the last category
            echo "\n\t</ul>\n</li>\n";
        }
    }
}

WordPress Version: 3.7

/**
 * Output entire list of links by category.
 *
 * Output a list of all links, listed by category, using the settings in
 * $wpdb->linkcategories and output it as a nested HTML unordered list.
 *
 * @since 1.0.1
 * @deprecated 2.1
 * @deprecated Use wp_list_bookmarks()
 * @see wp_list_bookmarks()
 *
 * @param string $order Sort link categories by 'name' or 'id'
 */
function get_links_list($order = 'name')
{
    _deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()');
    $order = strtolower($order);
    // Handle link category sorting
    $direction = 'ASC';
    if ('_' == substr($order, 0, 1)) {
        $direction = 'DESC';
        $order = substr($order, 1);
    }
    if (!isset($direction)) {
        $direction = '';
    }
    $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
    // Display each category
    if ($cats) {
        foreach ((array) $cats as $cat) {
            // Handle each category.
            // Display the category name
            echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name) . "</h2>\n\t<ul>\n";
            // Call get_links() with all the appropriate params
            get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
            // Close the last category
            echo "\n\t</ul>\n</li>\n";
        }
    }
}