NB: Make sure you do a back up of your theme, files and database before attempting the tutorials


---- Last modified : Sep 16 2022

Estimated reading time : 1 minute, 12 seconds - 87 words

Here’s a quick tutorial that will allow you to display your WordPress links (from the Links tag) sorted by category. While this tab is technically a thing of the past, it can be useful to have due to interesting backlinks.

Simply add this code where ever you want.

// récuperer la taxonomy des catégories
$taxonomy = 'link_category';
$tax_terms = get_terms($taxonomy);
        // si les catégories existent on boucle
	if ($tax_terms) {
	foreach ($tax_terms  as $tax_term) {
	echo '<h2>'. $tax_term->name .'</h2>';
	// on donne les arguments
        $args = array(
	'category' => $tax_term->term_id,
	'orderby' => 'name',
	'order' => 'ASC',
	// On recupere les liens attribués et on boucle
        $bookmarks = get_bookmarks($args);
	foreach ( $bookmarks as $bookmark ) {
	// On affiche les liens correspondants
        printf( '<span class="links">+ <a href="%s">%s</a>',$bookmark->link_url, $bookmark->link_name );
	printf( '</span>' );

Links are now dynamic and we can n ow create new categories and add custom category links.

If your current configuration of WordPress does not have the Link tab, add the following filter in your functions.php file:

add_filter( 'pre_option_link_manager_enabled', '__return_true' );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>