Hello I have made a PHP script for wordpress that insert new posts using a custom type via wp_insert_post.
Using the code above I can get the post saved but i can’t edit it using the admin panel. I’m wondering why? can anybody help me?
$post = array(
'comment_status' => 'closed',
'post_author' => 1,
'post_date' => date('Y-m-d H:i:s'),
'post_content' => $postdata['name'],
'post_status' => 'publish',
'post_title' => strtoupper(strip_tags($postdata['name'])),
'post_type' => 'xCustom' // custom type
);
wp_insert_post($post);
Thank you
WordPress converts all custom post type slugs to lowercase, so instead of using:
You should be using:
I just spent 3 hours troubleshooting this on my own site.