I'm getting a really strange bug (WP 3.1.3). My goal is to have users create a new post simply by landing on a single post. In order to make that happen, I have the following code in my single.php:
<?php
//-- Set up post values
$myPost = array(
'post_status' => 'publish',
'post_type' => 'post',
'post_author' => 2,
'post_title' => 'e3i8ir',
'comment_status' => 'closed',
'ping_status' => 'closed',
'post_category' => array(24),
);
//-- Create the new post
$newPostID = wp_insert_post($myPost);
?>
By all rights, this should just insert one record, right? When I use this function, however, it creates TWO posts, exactly alike.
Looking at the page, the_content only displays once, so it's not like the page is displaying multiple times (and therefore causing two wp_insert_post calls).
Does anyone have any ideas what would cause this?
Thanks in advance, --eric