WordPress query to fetch links

<?php

$linkeQry=”SELECT * FROM $wpdb->links”;

$linksData = $wpdb->get_results($linkeQry);

?>

<ul>

<?php foreach($linksData as $key=>$link) {  ?>

<li><a href=”<?php echo $link->link_url; ?>” target=”_blank”><?php echo $link->link_name; ?></a></li>

<?php } ?>

</ul>

Share

Leave a Reply

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