Support » Fixing WordPress » Creating a category outside of wordpress

  • Resolved dorlowski



    I plan on having many categories/subcategories in 2.8 as I will be hacking WP up to more of a searchable directory CMS. Basically, every US State is a category. Rather than key in 50+ states, I have a php script setup that calls this code:

    wp_create_category(‘New York’);

    Its repeated with each state (dynamically created)

    What include files do I need to call before I can do this? I searched everywhere but can’t seem to find it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • wp-load.php should be all

    I tried that, and it doesn’t recognize the wp_create_category function call. I looked at that create category function and it resides in the wp-admin folder. Does wp-load.php load those calls too?

    I found the solution. I placed the *temporary* php source file with my function calls inside the wp-admin directory, then included the admin.php file:

    wp_create_category('test category');

    This worked like a charm. Then I deleted the php file from the admin directory. You can place the source php file anywhere so long as you reference the admin call(?)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating a category outside of wordpress’ is closed to new replies.