WordPress.org

Ready to get started?Download WordPress

Forums

Using wp_list_categories with child_of and number causes SQL error (1 post)

  1. EJ2K
    Member
    Posted 6 years ago #

    When using the wp_list_categories function to display a parent's child categories and limiting the results, I get an SQL error.

    Here is the function call I am using:

    wp_list_categories('show_count=1&use_desc_for_title=0&number=3&title_li=&child_of=27');

    Here is the SQL error message output:


    Warning: join(): Bad arguments. in /home/XXXXXXXXX/wp-includes/category.php on line 290

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND post_type = 'post' AND post_status = 'publish'' at line 1]
    SELECT post_id, category_id FROM wp_post2cat LEFT JOIN wp_posts ON post_id = ID WHERE category_id IN () AND post_type = 'post' AND post_status = 'publish'

    Warning: Invalid argument supplied for foreach() in /home/XXXXXXXXX/wp-includes/category.php on line 300

    Once I remove the number=3 argument, then it works.

    I am running WP 2.2.1 on Redhat Linux 9

Topic Closed

This topic has been closed to new replies.

About this Topic