Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.


has anyone been able to use wpDataTables (wordpress plugin) and the PHP serialized array option to loop through posts? Here is a basic WP_query I'm trying:

$plants = array();
$args = array(
    'post_type' => 'post'
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
        $title = get_the_title();
        $status = get_post_status();
        $plants[] = array(
            'title' => $title,
            'status' => $status );
endwhile;
endif;
echo( serialize($plants) );

This outputs the required serialized array, but wpDataTables only shows a "No Data" column.
Any assistance would be appreciated.

Kind regards
Ryan

share|improve this question

closed as off-topic by Jamal Feb 24 at 6:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions containing broken code or asking for advice about code not yet written are off-topic, as the code is not ready for review. After the question has been edited to contain working code, we will consider reopening it." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.