Skip to content

Instantly share code, notes, and snippets.

@joedooley
Created May 18, 2020 14:12
Show Gist options
  • Save joedooley/42634b7295ab1278228e86468305f04b to your computer and use it in GitHub Desktop.
Save joedooley/42634b7295ab1278228e86468305f04b to your computer and use it in GitHub Desktop.
Enable CORS hack. Do not use in PROD!!!!
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token Authorization');
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require dirname( __FILE__ ) . '/cms/wp-blog-header.php';
@joedooley
Copy link
Author

This should only be used if your debugging CORS issues in a local development environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment