开发者

Missing includes in Wordpress plugin (wp_insert_post function)

开发者 https://www.devze.com 2023-03-23 16:06 出处:网络
I created a code开发者_运维百科 which generates content and I want to populate Wordpress\'s database with it. I am using wp_insert_post andadd_post_meta functions but every time I load which triggers

I created a code开发者_运维百科 which generates content and I want to populate Wordpress's database with it. I am using wp_insert_post and add_post_meta functions but every time I load which triggers the script I get this error:

Fatal error: Call to undefined function add_action() in \www\scriptmafia\wp-includes\post.php on line 153

To my mind it due to some missing includes. I have included post.php which it mentioned as required include for wp_insert_post function.

I know this is pretty common among newbies in WordPress. However, any solution I have tried have not worked for me.


require_once( ABSPATH . '/wp-load.php'); should solve it :)

0

精彩评论

暂无评论...
验证码 换一张
取 消