wppaste
WordPress

get_links_list( string $order = 'name' )

Since
1.0.1
Source
wp-includes/deprecated.php:1040
Output entire list of links by category.

Description

Output a list of all links, listed by category, using the settings in $wpdb->linkcategories and output it as a nested HTML unordered list.

Compatibility

Deprecated in WordPress 2.1.0. Use wp_list_bookmarks()

WordPress
since 1.0.1
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Parameters

$orderstringoptional
Sort link categories by 'name' or 'id'Default: 'name'

Performance profile

How much work a call to get_links_list() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Heavy

Reaches the database via get_terms().

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
25–33

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 58.

Plugin surface
1 hook

Third-party callbacks on 'link_category' run inside this call, and their cost is not bounded by anything here.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • querycontent queryget_terms()one call below get_links_list()
  • optionoption read or writeget_option()one call below get_links_list()

Further down the call graph this can also reach cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 1 distinct outcome

One number would be a lie: the work depends on which branch runs. These are every distinct cost get_links_list() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always25–33_deprecated_function(), strtolower(), link()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev5825–335
8.55825–335
8.45825–3356 fewer instructions than PHP 8.3
8.36428–395
8.26428–395
8.16428–395
7.46428–395

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Hooks and filters fired · 1

One hook fires while get_links_list() runs, in this order:

  1. apply_filters( link_category )filterline 1063 (+23 into the body)

    Filters the category name.

Uses · 5

Source code

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";		}	}}

Changelog

Introduced in 1.0.1. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

2.1.0
Deprecated. Use wp_list_bookmarks()from the docblock
1.0.1
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/deprecated.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.