Title: Create a regular XML post export
Last modified: August 19, 2016

---

# Create a regular XML post export

 *  [jamesbc](https://wordpress.org/support/users/jamesbc/)
 * (@jamesbc)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/create-a-regular-xml-post-export/)
 * Our blog is going to be feeding news to another site and we need to format it
   in XML (to the other site’s spec) and send it at regular intervals (or whenever
   there’s a new post).
 * I’ve thought about creating a template for this, but wonder if it’s the right
   way to do it.
 * I’ve searched for a plugin but couldn’t find one.
 * The site uses the Feedburner plugin but also the <more> tag so the RSS only exports
   the first paragraph of every story (and the Feedburner XML format isn’t the right
   one anyway). In short, RSS is out.
 * Does anyone have any thoughts?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 11 months ago](https://wordpress.org/support/topic/create-a-regular-xml-post-export/#post-796575)
 * Create a new “feed”.
 * A feed, in WordPress, is basically just a special template with the proper hook.
   This would do the trick:
 *     ```
       function feed_fake($comment) {
       ...do stuff...
       }
       function add_my_feed() {
       add_feed('fake', 'feed_fake');
       }
       add_action('init','add_my_feed');
       ```
   
 * The resulting URL will be along these lines:
    [http://example.com/blog/feed/fake/](http://example.com/blog/feed/fake/)
   or [http://example.com/blog/?feed=fake](http://example.com/blog/?feed=fake) …
   depending on your permalinks, of course.
 * Now, the code in feed_fake would be basically similar to the stuff in feed_rss2.
   php or what have you. It’s just going to output XML, do the Loop, whatever you
   need to create your XML output. The existing feeds work exactly this way. In 
   their feed functions, they simply do a `load_template( ABSPATH . WPINC . '/feed-
   rss2.php' );` to create their output.
 *  Thread Starter [jamesbc](https://wordpress.org/support/users/jamesbc/)
 * (@jamesbc)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/create-a-regular-xml-post-export/#post-796715)
 * Thanks Otto.
 * Let me see if I have this right (I’m relatively new to WP).
 * I’d add that function to the function file, then create a new template called
   feed_fake.php (based on another feed template), tweak the formatting and I’d 
   be good to go?
 * What would I need to put in place of the “do stuff” line?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 11 months ago](https://wordpress.org/support/topic/create-a-regular-xml-post-export/#post-796730)
 * Something along the lines of this would work for the “do stuff”:
    `load_template(
   TEMPLATEPATH . '/feed-fake.php' );`
 * The idea is that when somebody asks for the feed, that function gets called. 
   It can do anything you like to generate the feed. If you are putting the feed
   into a new file in the theme, than that line above will load and run it as any
   other template.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Create a regular XML post export’ is closed to new replies.

## Tags

 * [export](https://wordpress.org/support/topic-tag/export/)
 * [RSS](https://wordpress.org/support/topic-tag/rss/)
 * [xml](https://wordpress.org/support/topic-tag/xml/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/create-a-regular-xml-post-export/#post-796730)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
