Last active
October 10, 2019 19:49
-
-
Save homanp/9c709e3653037a3c1e7400e247725d04 to your computer and use it in GitHub Desktop.
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
function start_wp_head_buffer() { | |
ob_start(); | |
} | |
add_action('wp_head','start_wp_head_buffer',0); | |
function end_wp_head_buffer() { | |
$in = ob_get_clean(); | |
echo $in; // output to head-tag | |
} | |
add_action('wp_head','end_wp_head_buffer', PHP_INT_MAX); | |
add_action('rest_api_init', function () { | |
register_rest_route( 'hs/v1', 'header',array( | |
'methods' => 'GET', | |
'callback' => 'end_wp_head_buffer' | |
)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment