'My new post',
'post_content' => 'Content to insert.',
'post_status' => 'publish'
);
$post_id = wp_insert_post( $new_post );
if( $post_id ){
echo "Post inserted successfully with the post ID of ".$post_id;
} else {
echo "Error, post not inserted";
}
Copyright © 2025 by WP CODE SNIPPETS
Join our mailing list to receive the latest news and updates from our team.