Get entire post in variable

Wpsnipp – How to get entire post in variableVariables are one of the core powers of programming. Adding this PHP code to your functions.php file of your wordpress theme will place a entire page into a PHP variable.



function callback($buffer) {
// modify buffer here, and then return the updated code
return $buffer;
function buffer_start() {
function buffer_end() {
add_action('wp_head', 'buffer_start');
add_action('wp_footer', 'buffer_end');

Leave a comment