Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Last active March 26, 2016 19:15
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 woodwardtw/ca5ba71d91b12a668c55 to your computer and use it in GitHub Desktop.
Save woodwardtw/ca5ba71d91b12a668c55 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Allow Cross Origin Access to Feeds
* Plugin URI: https://gist.github.com/woodwardtw/ca5ba71d91b12a668c55
* Description: I think this is safe and should just add access control origin access to the feeds but I'm just playing at this
* Version: .9
* Author: Tom Woodward
* Author URI: http://bionicteaching.com
* License: GPL2
*/
/* 2016 Tom (email : bionicteaching@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Modify HTTP header
*/
add_action( 'pre_get_posts', 'add_header_origin' );
function add_header_origin() {
if (is_feed()){
header( 'Access-Control-Allow-Origin: *' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment