Title: Permissions error when using wp_insert_post externally
Last modified: August 21, 2016

---

# Permissions error when using wp_insert_post externally

 *  [Rambomst](https://wordpress.org/support/users/rambomst/)
 * (@rambomst)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/permissions-error-when-using-wp_insert_post-externally/)
 * 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 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/permissions-error-when-using-wp_insert_post-externally/#post-4109290)
 * If you can find where in WP code the message is coming from (it’s not wp_insert_post()
   itself) you can likely determine the condition causing it and take measures so
   it no longer happens. Try GREPping the entire WP installation for a portion of
   the message and see what comes up.
 * I’d normally give it a go myself for you, but I can’t currently access my installation
   for a while, so all I can do is suggest you try it.

Viewing 1 replies (of 1 total)

The topic ‘Permissions error when using wp_insert_post externally’ is closed to 
new replies.

## Tags

 * [permissions](https://wordpress.org/support/topic-tag/permissions/)
 * [wp_insert_post](https://wordpress.org/support/topic-tag/wp_insert_post/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/permissions-error-when-using-wp_insert_post-externally/#post-4109290)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
