[wp-hackers] $wp_taxonomies is pretty strange - change appreciated

24/7 24-7 at gmx.net
Fri Feb 11 13:55:47 UTC 2011


@Jon & Nacin: Thanks. That really caused me some headaches.

I ended up with the following:
function get_object_types_unique( $all_r_custom = false ) {
	$tax_object = get_taxonomies( array( '_builtin' => $all_r_custom ),
'objects' );
	if ( $all_r_custom == true )
		$tax_object = array_merge( $tax_object,
get_taxonomies( array( '_builtin' => false ), 'objects' ) );

	$object_types = array();
	foreach ( $tax_object as $tax ) {
		$object_types = array_merge( $object_types, $tax->object_type );
	}

	$object_types = array_unique( $object_types );
	return $object_types;
}
The drawback is that i have to ask the DB for twice to retrieve all,
but it's ok so far.

- K.


More information about the wp-hackers mailing list