[resolved] Creating a category outside of wordpress (4 posts)

  1. dorlowski
    Posted 5 years ago #


    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.

  2. Adam Harley (Kawauso)
    Posted 5 years ago #

    wp-load.php should be all

  3. dorlowski
    Posted 5 years ago #

    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?

  4. dorlowski
    Posted 5 years ago #

    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(?)

Topic Closed

This topic has been closed to new replies.

About this Topic