Hi! I have installed WP Data Tables and am trying to get it to draw from a serialised php array. The code I am using to generate my array is copied from the WP Data Tables guidance, but something in X seems to be blocking it. Can you offer any advice?
Thanks in advance!
Alex
<?php // Initializing the WordPress engine in a standalone PHP file include('../../../wp-blog-header.php'); header("HTTP/1.1 200 OK"); // Forcing the 200 OK header as WP can return 404 otherwise // Preparing a WP_query $the_query = new WP_Query( array( 'post_type' => 'my_deals', // We only want deals 'post_count' => -1 // We do not want to limit the post count // We can define any additional arguments that we need - see Codex for the full list ) ); $return_array = array(); // Initializing the array that will be used for the table while( $the_query->have_posts() ){ // Fetch the post $the_query->the_post(); // Filling in the new array entry $return_array[] = array( 'Client' => get_permalink().'||'.get_field('client_text_name'), // Set the title 'Date completed' => get_field('date'), // Set the value 'Deal/Matter' => get_field('matter'), // Set the value 'Sector' => get_field('sector'), // Set the value 'Description' => get_field('description') // Get first 200 chars of the content and replace the shortcodes and tags ); } // Now the array is prepared, we just need to serialize and output it echo serialize( $return_array );