Support » Fixing WordPress » Fatal error when trying to list categories

  • I’m trying to list certain categories in a file I named categories.php, but each time I refresh I get

    Fatal error: Call to undefined function: wp_list_cats() in /home/sites/ on line 10

    I don’t understand what I’m doing wrong. Help, anyone? Here’s the coding for categories.php

    <? include('header.php'); ?>

    <div class=storycontent>
    <h3>The reviews</h3>

    Below are listed the movies reviewed so far. All movies have been set as categories, and may contain several reviews, each by another reviewer.

      <?php wp_list_cats('sort_column=name&optioncount=1&exclude=1, 17'); ?>

    <? include('footer.php'); ?>

    Any help appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You might try re-uploading template-functions-category.php (in the wp-includes/ directory). This is the script which holds the wp_list_cats() function, and possible it’s corrupted or incomplete.

    EDIT: Read over your post again and it appears this is for a PHP document which is not part of the standard WP theme template hierarchy. To use a WordPress function in PHP scripts which reside outside WordPress, you need to include the wp-blog-header.php file, found in your blog’s root directory.

    Ahh, thank you so much! 😀 Your solution worked like a charm.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error when trying to list categories’ is closed to new replies.