How to call wordpress functions in custom php scri

2019-01-16 10:20发布

I have a Php script I want to use for creating a new blog in WPMU. I am having trouble calling wordpress functions like wpmu_create_user and wpmu_create_blog.

My hope is to get this script running as a cron job from command line and pick up new blog creation requests from an external db, create a new blog using the wordpress functions and update the db with new blog info.

标签: php blogs wpmu
7条回答
别忘想泡老子
2楼-- · 2019-01-16 10:56
require_once('../../../wp-load.php');

I think you have to add this line before any usage of wordpress function in your custom file. and make sure i have add ../ 3 times as per my wordpress installation structure.It's depends on your structure checks manually. ex. if your custom file is inside your themes/yourtheme/custom.php then above code will works perfectly and if not then add ../ or remove one or more ../ as per your path.

查看更多
登录 后发表回答