Calling a shortcode in the backend

As you noticed, the plugin use an instance of the class TablePress_Frontend_Controller to render the shortcode.

This instance is created by only on frontend requests, this is the reason why shortcode doesn’t work on backend.

The function tablepress_print_table function use the TablePress_Frontend_Controller::shortcode_table method to render the table, and this is the reason why also that function doesn’t work.

So what you need is create an instance of that class and call shortcode_table method. However to do this, you need to load the required files and setup class dependencies, but luckely the plugin main class 'TablePress' has a static method that do all the hard work: load_controller.

You can use it to write a custom function and put it in your plugin or theme functions.php

function tablepress_backend_table( $id = '' ) {
  if ( empty($id) ) return;
  if ( class_exists('TablePress') ) {
    $c = TablePress::load_controller( 'frontend' );
    echo $c->shortcode_table( array('id' => $id ) );
  }
}

after that where you need you can print the wanted able like so:

// print the table with ID = '1'
tablepress_backend_table( '1' );

However, that will print the table without styling. In fact, the plugin doesn’t add css on backend, so if you want your tables display styled you need to enqueue plugin styles by yourself (.css files are in the ‘css’ subfolder of plugin).
For that pourpose be sure to use wp_enqueue_style function hooked into admin_enqueue_scripts hook and use some logic to enqueue the styles only in the specific admin pages where you need them.

error code: 523