Skip to content

Instantly share code, notes, and snippets.

@roborourke
Created September 24, 2012 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roborourke/3775609 to your computer and use it in GitHub Desktop.
Save roborourke/3775609 to your computer and use it in GitHub Desktop.
Replace default feed in WordPress
<?php
add_action( 'init', 'use_alt_feed' );
function use_alt_feed() {
if ( is_feed() && is_post_type_archive( 'my_post_type' ) ) {
$feed = get_default_feed();
remove_action( 'do_feed_' . $feed, 'do_feed_' . $feed );
add_action( 'do_feed_' . $feed, 'my_custom_feed' );
}
}
function my_custom_feed() {
load_template( '/path/to/feed/template.php' );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment