How to call WordPress functions in a custom PHP script

后端 未结 7 464
小蘑菇
小蘑菇 2020-12-07 16:52

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 hop

7条回答
  •  囚心锁ツ
    2020-12-07 17:33

    This should work:

    require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
    

    i.e. When the php script is on the same server and WP is installed on the root. As most cases are.

提交回复
热议问题