Support » Fixing WordPress » Adding Links to a Post Category

  • One of the features I was hoping for with the new link categories was the ability to add a link to a post category. Initially when I saw the categories admin area, and the posts and links count columns, I began to thing that it would be possible to add a link to the same category as a post.

    Unfortunately, the category admin page is misleading. Even though, both link and post categories are stored in the same table, the behavior is different. So when you go to add a link you don’t see all your categories. I am not sure if this is intentional or a flaw in the SQL used in return_link_categories_list(), this function can be found in the admin-function.php file.

    SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( category_count = 0 OR link_count != 0 OR ( link_count = 0 AND category_count = 0 ) ) ORDER BY link_count DESC

    since the first check is category_count = 0, if you add a post to your category first, then you will never be able to add a link to that category.

    So if anyone want’s to add a link to a post category, then the you will have to remove the AND condition from the above SQL, well that’s what I had to do to make it work.

    But if anyone knows a better solution, do suggest.

  • The topic ‘Adding Links to a Post Category’ is closed to new replies.