Skip to content

Instantly share code, notes, and snippets.

Created September 10, 2019 06:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
* Code snippet to expose ninja tables data as JSON via URL
* Example URL:
* In this url 1463 is the table ID that you want to access the data using JSON
* You should change the key 'your_security_key' in the url as well in the code
* to protect the endpoint
add_action('init', function() {
if(isset($_GET['get_ninja_table_data'])) {
$securityKey = 'your_security_key';
$key = $_GET['key'];
if($key != $securityKey) {
exit('key mismatch');
$tableId = intval($_GET['get_ninja_table_data']);
$data = ninjaTablesGetTablesDataByID($tableId);
Copy link

Thank you for showing this option - I have modernized this concept to leverage the built in REST api features of WordPress at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment