Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Rambomst on "Permissions error when using wp_insert_post externally"

$
0
0

I have a php script that runs outside of wordpress.

All it contains is the following code.

require_once "../wp-load.php";
$imagePost = array(
		'post_title' => 'Here',
		'post_content' => 'Content added later.',
		'post_status' => 'publish',
		'post_author' => 1,
		'tags_input' => "''",
		'post_category' => array(1),
		'post_type' => 'post'
);

$postID = wp_insert_post($imagePost, true);
die($postID);

I use to be able to run that without any issues however it now comes up with a white page and the message "Are you sure you want to do this?". I am really at a loss as to how I should fix this.

Any help is much appreciated.


Viewing all articles
Browse latest Browse all 8245

Trending Articles