当我想使用wp_insert_post( $my_post ); 函数我收到以下错误:
致命错误:无法在 /home/izradawe/public_html/mydomain.com/wp-includes/post 中重新声明 create_initial_post_types()(之前在 /home/izradawe/public_html/mydomain.com/wp-includes/post.php:20 中声明) .php 在第 152 行
你能帮我解决这个问题吗?
我使用的代码:
include_once('../wp-load.php');
include("../wp-includes/post.php");
// Creating post
$my_post = array(
'post_title' => 'My post',
'post_content' => 'This is my post.',
'post_status' => 'publish',
'post_author' => 1,
'post_category' => 5,
'post_type' => 'post'
);
// Insert the post into the database
wp_insert_post( $my_post );