How To Post Articles To Wordpress Programmatically?
Wondering is there a way so that you can post an article to Wordpress directly from your own PHP code. I want to post in my own standalone wordpress from my php page which should call the hosted wordpress 2开发者_开发技巧.8.6 version and post an article with images (create thumbnail automatically). Is it possible?
global $user_ID;
$post = array();
$post['post_type'] = 'post';
$post['post_content'] = 'Put your post content here';
$post['post_author'] = $user_ID;
$post['post_status'] = 'publish';
$post['post_title'] = 'Your Post Title';
$postid = wp_insert_post ($post);
if ($postid == 0)
echo 'Oops!';
else
echo 'Snazzy!';
From: http://wordpress.org/support/topic/254439
As an alternative to PHP script, you can use Yahoo to do so if you find this interesting, here is the link:
http://wordpressmodder.org/how-to-post-to-your-wordpress-site-directly-from-yahoo-mail-570.html
Uses Wordpress's existing XMLRPC functions: Post on your WordPress blog using PHP
精彩评论