When I want to use wp_insert_post( $my_post ); function i get the following error:
Fatal error: Cannot redeclare create_initial_post_types() (previously
declared in
/home/izradawe/public_html/mydomain.com/wp-includes/post.php:20) in
/home/izradawe/public_html/mydomain.com/wp-includes/post.php on line
152
Can you help me with this?
Code which I using:
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 );
In order to gain access to WordPress’ main functions, try: