[wp-trac] [WordPress Trac] #14389: Refactor wp_get_recent_posts to use get_posts function
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 22 17:37:26 UTC 2010
#14389: Refactor wp_get_recent_posts to use get_posts function
-------------------------+--------------------------------------------------
Reporter: blepoxp | Owner: blepoxp
Type: enhancement | Status: new
Priority: normal | Milestone: 3.1
Component: Performance | Version:
Severity: normal | Keywords: has-patch dev-feedback
-------------------------+--------------------------------------------------
Changes (by blepoxp):
* keywords: has-patch needs-testing => has-patch dev-feedback
Comment:
This is the best solution I found for converting an Object to an array
outside of the foreach loop I used but it would include introducing
another function. Thoughts? (I couldn't find a wp function that already
did this).
{{{
function wp_object_to_array( $object ) {
if ( !is_object( $object ) && !is_array( $object ) )
return $object;
if ( is_object( $object ) )
$object = get_object_vars( $object );
return array_map( 'wp_object_to_array', $object );
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14389#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list