Home » Archive

Articles tagged with: PHP

Featured, Technology »

[11 Sep 2009 | No Comment | 31 views]

Recently, I needed to call the wp_create_category function call from outside the wordpress install in a source php file. I was advised to use wp-load.php as my include, but that didn’t do the trick as the function I was looking for was sourced in the admin directory.
The solution to this is source the admin.php file located inside the wp-admin directory.
Then you can call the admin functions directly in your php scripts.
include(‘../wp-admin/admin.php’);
wp_create_category(‘test category.php’);
//that’s it!
Of course, remove the source php file that calls this function so that no one else can call …