dorlowski
Member
Posted 2 years ago #
Hello,
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.
wp-load.php should be all
dorlowski
Member
Posted 2 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?
dorlowski
Member
Posted 2 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:
require('admin.php');
//test
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(?)