Search
 
SCRIPT & CODE EXAMPLE
 

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
);

Comment

PREVIOUS NEXT
Code Example
Php :: status code 301 
Php :: using laravel passport with mongodb 
Php :: check date is in the last 24 hours? 
Php :: Redirect User To Different Page 
Php :: View [layouts.master] not found 
Php :: map array php 
Php :: php set time counters inside code meassure 
Php :: setup phpmyadmin to show create statement query 
Php :: laravel reroute 419 
Php :: Create fake users on click laravel 
Php :: get the matched value from 2 array in php 
Php :: php remove everything before colon 
Php :: Laravel Unique Multiple Column validation 
Php :: laravel sync with attributes 
Php :: csv file import to mysqli using php 
Php :: how to make trait in laravel 
Php :: laravel collection shift 
Php :: php keep input value after submit 
Php :: can i back up mysql database from php code? 
Php :: magento 2 laravel valet 502 bad gateway 
Php :: laravel show method 
Php :: laravel use npm package 
Php :: netchainmedia 
Php :: use external variable in php function 
Php :: php custom error log 
Php :: php typecast class 
Php :: php date with out 0 
Php :: how to make primary key and foreign key in phpmyadmin 
Php :: laravel excel 
Php :: show widget using the shortcode from php 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =