accessing link descriptions (2 posts)

  1. bdee1
    Posted 2 years ago #

    I am wondering if there is a simple way to access the description field for links.

    I have a 3rd party plugin (Hierarchical Link Categories) which has a custom function for displaying the links in nested categories. Unfortunately it does not provide a way to display the link descriptions in this format. So I would like to modify their plugin to include descriptions.

    I knwo that I can do something like this to query the wordpress database, but I am not sure where the link descriptions live...
    <?php $link_desc = $wpdb->get_var("SELECT something FROM wp_something WHERE somthing") ?>.

    can someone point me in the right direction here?

  2. Chris
    Posted 2 years ago #

    If you are using link manager in the WordPress backend the links will be stored in the {prefix}_links table that has kinda self-explaining columns like 'link_url', 'link_name', 'link_description'...

    I haven't checked your specific plugin's approach but generally speaking, instead of quering the database yourself you could simply use

    $links = get_bookmarks(
        'orderby'          => 'name',
        'order'            => 'ASC',
        'limit'            => -1
    foreach( $links as $link ) {
      // $link->link_url
      // $link->link_link_name
      // $link->link_description
      // ...

Topic Closed

This topic has been closed to new replies.

About this Topic