How Can I Automatically import an RSS feed as a WordPress blog post? (2 posts)

  1. timwix
    Posted 6 years ago #

    Wondering if someone can help me automatically import an RSS feed as a WordPress blog post? The RSS feed updates everyday and I am not importing just a static file.

  2. bekar09
    Posted 6 years ago #

    create a script which will get the contents of the RSS feed and store in a variable. from that variable, using regular expression, separate the title and store it in a variable(suppose $title) and the content in another variable(suppose $content).

    then you have to call the wp_insert_post and pass $title and $content to the function which in turn will return $postid.

    Finally you can run this script using cron tab.

    In this way you can add tags also. please refer http://codex.wordpress.org/Function_Reference/wp_insert_post for more detailed information.

    N.B: one more trick. if you want to stop duplicate posting, then in wp-includes/post.php, find suffix=2. just before that line add 'return 0'. this is for WP 2.7.1. for latest version you have to dig into the code. I havent updated WP yet.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.