Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

WordPress Convert Object To Array

<?php
/*
 * Convert Object To Array
*/

$args = array(
	'showposts' => -1,
	'post_type' => 'post',
	'post_status' => 'publish'
);
$result = new WP_Query($args);

$data = array_map(
	function( $post ) {
		return (array) $post;
	},
	$result->posts
);

Source by gist.githubusercontent.com #
 
PREVIOUS NEXT
Tagged: #WordPress #Convert #Object #To #Array
ADD COMMENT
Topic
Name
7+3 =