How to call WordPress functions in a custom PHP script

后端 未结 7 477
小蘑菇
小蘑菇 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

    include wp-load.php file (in the root of your wordpress installation) in your php script file like so,

    require_once("/path/to/wordpress/wp-load.php");
    

    you will have to provide the abspath of the wp-load file, now you can use all the functions of wordpress in your php script

提交回复
热议问题