WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] get_categories Deprecated Argument? (3 posts)

  1. JimFitzsimons
    Member
    Posted 3 years ago #

    Hi there, I originally posted this on the 'Themes and Templates' forum, which was clearly the wrong place, and also managed to fall foul of the rules about posting code (will use pastebin this time!)

    So if the mods want to delete one of these posts as a duplicate then please get rid of the original post on the 'Themes and Templates' forum and leave this one here. Sorry. And thanks!

    Anyway, hopefully someone can help me with this as I can't seem to find any reference to it elsewhere.

    The theme I'm putting together has a Links Template that outputs all of the Links by category (i.e. 'Blogroll', 'Related Sites', etc.) The code I'm using works fine when Debug mode is switched off, but produces a PHP Notice when Debug is on:

    Notice: get_categories was called with an argument that is deprecated since version 3.0!

    The only line I can see being the problem is:
    $categories = get_categories('type=link');

    But nothing on the get_categories() function page suggests that "type" has been deprecated.

    I'm using WordPress 3.2.1.

    It's probably unnecessary, but the complete code can be found at pastebin:

    http://pastebin.com/LitthWcc

    When I delete that code chunk from the template, the PHP Notice disappears.

    Cheers!
    jim.

  2. aphill70
    Member
    Posted 3 years ago #

    Hey Jim,

    Looking at the source code for get_categories they have deprecated the type argument with the link option.

    the code appears to set the argument to 'taxonomy=link_category'

    Hopefully that helps if you would like to see the code

    http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/category.php

    line 48 is where the deprecated function is being called

    Good Luck

  3. JimFitzsimons
    Member
    Posted 3 years ago #

    Ahhh... many thanks aphill70.

    That's sorted it out. Clearly the Codex needs to be updated for this function.

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic