Support » Fixing WordPress » Using wp_list_categories with child_of and number causes SQL error

  • 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:


    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

  • The topic ‘Using wp_list_categories with child_of and number causes SQL error’ is closed to new replies.