you are here: codestackercodes [RSS]wordpress: posting via php

wordpress: posting via php

via http://codex.wordpress.org/Function_Reference/wp_insert_post

<?php

	include "wp-blog-header.php";

	$my_post = array();
	$my_post['post_title'] = 'My post';
	$my_post['post_content'] = 'This is my post.';
	$my_post['post_status'] = 'publish';
	$my_post['post_author'] = 1;
	$my_post['post_category'] = array(13);

	$post_id = wp_insert_post($my_post);

	$post = get_post($post_id);
	wp_redirect($post->guid);

?>

Comments