Demo plugin for JSON export:
I’m not sure the RSS feed structure suits your needs, for example taxonomies and terms don’t have any dates for the public date field. So here’s an example how you can retrieve all the terms for a given taxonomy:
/**
* Plugin Name: WPSE - JSON export all terms for a given taxonomy.
* Plugin URI: http://wordpress.stackexchange.com/a/151908/26350
* Version: 0.0.1
*/
add_filter( 'query_vars', function( $qv ){
$qv[] = 'wpse-export-taxonomy';
return $qv;
});
add_action( 'template_redirect', function(){
$tax = get_query_var( 'export-taxonomy' );
if( ! empty( $tax ) )
{
if( taxonomy_exists( $tax ) )
{
$data = get_terms( sanitize_key( $tax ),
array(
'hide_empty' => true,
'orderby' => 'name',
'order' => 'ASC',
)
);
if( count( $data ) > 0 )
wp_send_json_success( $data );
}
}
// Error:
wp_send_json_error();
} );
where you can modiy the get_terms()
arguments to your needs.
Usage Examples:
Categories export:
http://example.com/?wpse-export-taxonomy=category
Post tags export:
http://example.com/?wpse-export-taxonomy=post_tag
Custom country
taxonomy export:
http://example.com/?wpse-export-taxonomy=country
The category export could look like this:
{"success":true,"data":{
"0":{"term_id":"65","name":"animals","slug":"animals","term_group":"0","term_taxonomy_id":"75","taxonomy":"category","description":"id:65","parent":"0","count":"5"},
"1":{"term_id":"61","name":"birds","slug":"birds","term_group":"0","term_taxonomy_id":"70","taxonomy":"category","description":"id:61","parent":"65","count":"8"}
"2":{"term_id":"13","name":"falcons","slug":"falcons","term_group":"0","term_taxonomy_id":"15","taxonomy":"category","description":"id:13","parent":"61","count":"3"}
}}
I hope this helps.