get_bookmarks() object doesn't return link_category

Posted by ninja on Stack Overflow See other posts from Stack Overflow or by ninja
Published on 2012-04-11T11:11:59Z Indexed on 2012/04/11 11:30 UTC
Read the original article Hit count: 167

Filed under:
|

I'm trying to fetch all link-categories from the built in Wordpress linklist (or bookmarks if you will).

To do this, I simply stored all links in a variable like this:

<?php
    $lists = get_bookmarks();
    foreach($lists as $list) {
        $cats[] = $list->link_category;
    }
?>

To my surprise even var_dump'ing $cats gave me "String(0)", so I var_dump'ed out $lists instead, and it gave me this:

array(8) { [0]=> object(stdClass)#5126 (13) { ["link_id"]=> string(1) "1" ["link_url"]=> string(27) "http://codex.wordpress.org/" ["link_name"]=> string(13) "Documentation" ["link_image"]=> string(0) "" ["link_target"]=> string(0) "" ["link_description"]=> string(0) "" ["link_visible"]=> string(1) "Y" ["link_owner"]=> string(1) "1" ["link_rating"]=> string(1) "0" ["link_updated"]=> string(19) "0000-00-00 00:00:00" ["link_rel"]=> string(0) "" ["link_notes"]=> string(0) "" ["link_rss"]=> string(0) "" }

Now, codex.wordpress.org is a default link that comes with wordpress, it's in a category called "Linklist", and as you can see, the object contains everything about that link, EXCEPT the categoryname.

According to the codex this object should contain a field named "link_category", so I'm getting confused here.

Am I missing something? Is the function broke?

Regards

NINJA

© Stack Overflow or respective owner

Related posts about php

Related posts about Wordpress