Last active
September 12, 2016 13:45
-
-
Save j4ckth3r1pp3r/0ae3101b18dc8cb0ec4c078523cf01cf to your computer and use it in GitHub Desktop.
JSON template for WP use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('WP_USE_THEMES', false); | |
preg_match('/(.*)wp-content/', __DIR__, $matches); | |
$root_folder = $matches[1]; | |
require( $root_folder.'/wp-blog-header.php' ); | |
$json = $_GET['json']; | |
if ( $json == 1 ) | |
{ | |
$json_data = array(); | |
header('Content-Type: application/json'); | |
echo json_encode($json_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | |
} else { | |
echo 'GTFO, kek'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment