wp_create_category not working
-
So I’m developing a PHP script to run on top of a WordPress installation, the idea being to import content from a third party into WordPress on a regular basis. So far, things have been going great. The script is up to nearly 400 lines now, and anything I’ve wanted to do with WordPress, I’ve been able to do with no problem. All I did was include this code at the very top:
if ( !isset($wp_did_header) ) { $wp_did_header = true; require_once( dirname(__FILE__) . '/wp-load.php' ); wp(); }
And I’ve been able to use lots of WordPress functions to automatically create posts, edit posts, add metadata to posts, delete posts, you name it.
Until now. I ran into a weird snag, and I can’t figure out what’s different here. I am simply trying to do this:
wp_create_category('Test category');
Nothing. It simply doesn’t work. The script stops executing when it gets to that line.
Though wp-load.php has presumably been taking care of this for me, I also tried specifically including taxonomy.php, wp-admin.php and wp-config.php. But no luck. Same results.
Any idea what’s so special about wp_create_category and what I should be doing here?
- The topic ‘wp_create_category not working’ is closed to new replies.