Auto post from RSS feeds to WordPress

Published Updated 3 min read

A company blog republishing its own posts from another platform, a local news page gathering press releases, a deals site importing a partner's items: plenty of WordPress sites run on someone else's feed. The need is the same each time. New items appear in the feed; new posts should appear in WordPress.

FeedWordPress served that need for over a decade but has not seen significant updates in some time, and compatibility with current PHP and WordPress varies. WP RSS Aggregator does the job in a paid tier most single-feed sites will not want to buy. This build, written from one prompt by an AI WordPress plugin builder, sits in the gap between the two.

One feed is not complicated: a settings page with a URL and a few options, a WP-Cron job on a schedule, and an import loop that skips anything already imported. About sixty lines of working code and a small form.

Five settings and a cron job

Settings > RSS Auto Poster holds the feed URL (any RSS 2.0 or Atom feed), the schedule (hourly, twice daily or daily), the category for imported posts (any existing category, or uncategorised), the post status (draft or published) and how many items to take per run (1 to 50, default 10).

On schedule, WP-Cron fetches the feed with SimplePie, the library WordPress already bundles, which reads both RSS 2.0 and Atom. Each item is checked against stored GUIDs; anything already imported is skipped, and anything new becomes a post with the feed's title and content.

Imported posts keep their own dates

Each post takes the title, content and publication date from its feed item. The content is whatever the feed carries: some feeds include full article HTML, others only a summary, and the plugin imports exactly that.

Because the date comes from the item's own timestamp, yesterday's item sits in your archive as yesterday, not today. The original source URL is saved as post meta on every imported post, so you always know where it came from.

Draft is the default for a reason. Review the first small batch, check the content arrives cleanly, then switch to published. For a feed you control completely, such as your own newsletter platform's RSS, you can publish from the start.

Duplicates, schedule changes and a feed that is down

Duplicates are caught with the item's GUID, the permanent identifier RSS and Atom attach to each entry. It is stored as post meta on import, so an item is imported once even if it appears in ten consecutive fetches.

Change the schedule and the plugin unschedules the old cron event and registers a new one at the new interval. There is no need to deactivate and reactivate, and nothing already imported is affected.

If the feed URL is unavailable, the run ends without creating anything and tries again at the next scheduled time. Nothing errors and nothing is lost.

One feed per plugin

Pulling from several sources, mapping each to its own category and managing them all from one list screen is what WP RSS Aggregator is for. It is well maintained and its price reflects that larger scope.

If a feed only carries summaries and you want the full articles, you need a plugin that fetches the linked page and extracts the body. This one imports what the feed provides.

For one editorial feed, a partner import or a republishing workflow you control, the single-feed plugin is the simpler tool: you own the code, there is no subscription, and a follow-up message can extend it.

What you get

Included

  • An admin settings page to configure the feed URL, schedule, post category, and post status
  • A WP-Cron job that fetches the feed on the chosen schedule and creates WordPress posts from new items
  • Duplicate detection using each feed item's GUID stored as post meta so the same item is never imported twice
  • The source URL stored as post meta on every imported post

Not included

  • Multiple feed sources from one admin screen: one feed URL per plugin instance
  • Full-article content retrieval: the plugin imports only what the feed itself provides, not the linked page
  • Featured image import from feed enclosures or linked article thumbnails
  • A manual import trigger from the settings screen: imports run only on the cron schedule
  • Author attribution from feed item author fields

FeedWordPress does the things on the right. This build covers the part most sites use.

Questions

How do I avoid importing a large backlog on the first run?

Set the items-per-run limit to something small, like 3, before activating, and let the first run import a manageable batch. Review those drafts, then raise the limit. The GUID check means nothing is imported twice, so raising it later is safe.

Build it in Steem

The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.

Build this pluginAbout 55 credits. The free plan includes enough for one.
Read the prompt (344 words)

Build a WordPress plugin called RSS Auto Poster. Plugin Name: RSS Auto Poster. Description: Creates WordPress posts from an RSS or Atom feed on a schedule using WP-Cron. Single PHP file. No dependencies beyond WordPress core. Register a settings page under Settings > RSS Auto Poster using add_options_page. Register settings with register_setting in a group named rss_apt_settings. Fields: rss_apt_feed_url (text), rss_apt_post_status (select: draft or publish, default draft), rss_apt_category (integer, default 0 for uncategorised), rss_apt_frequency (select: hourly, twicedaily, daily; default daily), rss_apt_max_items (integer, default 10). Sanitize: feed URL with esc_url_raw, post status with sanitize_key restricted to draft or publish, category with absint, frequency with sanitize_key restricted to hourly/twicedaily/daily, max_items with absint clamped to 1-50. Settings page: a form using settings_fields and do_settings_sections. Add one settings section named rss_apt_main to the page slug rss-auto-poster. Add fields for: Feed URL (text input), Post Status (select: Draft / Published), Category (wp_dropdown_categories with show_option_all All/Uncategorised and echo false, selected on the saved value), Frequency (select: Hourly / Twice Daily / Daily), Max Items Per Run (number input min 1 max 50). Use add_settings_field for each. Wrap the form in a div with class wrap, an h1 heading, and a submit button via submit_button. Cron management: on register_activation_hook, unschedule any existing rss_apt_run event then call wp_schedule_event(time(), get_option('rss_apt_frequency','daily'), 'rss_apt_run'). On register_deactivation_hook, call wp_clear_scheduled_hook('rss_apt_run'). Hook a function to update_option_rss_apt_frequency that calls wp_clear_scheduled_hook then wp_schedule_event with the new frequency value. Import function hooked to rss_apt_run: get all options. If rss_apt_feed_url is empty, return. Call fetch_feed($url). If is_wp_error, return. $max = absint(get_option('rss_apt_max_items',10)); $items = $feed->get_items(0,$max). For each $item: $guid = $item->get_id(). Run get_posts with post_type post, post_status any, meta_key _rss_apt_guid, meta_value $guid, posts_per_page 1, fields ids. If non-empty, continue. Otherwise: $title = sanitize_text_field($item->get_title()), $content = wp_kses_post($item->get_content()), $date = $item->get_date('Y-m-d H:i:s') with fallback to current_time('mysql'), $link = esc_url_raw($item->get_permalink()). Call wp_insert_post with post_title, post_content, post_status from option, post_date, post_category as array containing absint of rss_apt_category option. If result is a positive integer, call update_post_meta twice: _rss_apt_guid to $guid and _rss_apt_source_url to $link. No inline JS. No AJAX. No external assets. No database tables. No block registration.