Storing current page WP list table HTML data into a PHP variable

I am trying to store my render post table HTML data of just the table into a PHP variable after the table is completely loaded.

I've tried to store:

$table = new Custom_Table_Example_List_Table();
$tablehtml = $table-display();

But this returns an array, not the full rendered table.. (e.g table.../table).

I have tried using JS var table = $(#tableid").html and with document.write to fire, but keeps coming back as undefined. But if I tie it to a click action of a button, the HTML data shows fine.

It may seem as if I would need to capture the data AFTER the system knows that the table and jQuery is loaded fully.

Topic parse wp-list-table jquery Wordpress

Category Web


Ah!

function callback($buffer) {
  // modify buffer here, and then return the updated code return $buffer;
}

function buffer_start() {
  ob_start("callback");
}

function buffer_end() {
  ob_end_flush();
}

add_action('wp_head', 'buffer_start');
add_action('wp_footer', 'buffer_end');

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.