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

24/7 24-7 at gmx.net
Thu Feb 10 21:21:07 UTC 2011


Thanks Nacin,

but you misunderstood me slightly. I didn't want to override anything,
just help someone. If you look at the code in the provided link,
you'll see that i simply wanted to get only not built in taxonomies.
Someone else already pointed me at the "_builtin" $arg of which i
wasn't aware.

Just to document what i needed:

// gives you an array of custom taxonomy objects
$custom_taxonomies = get_taxonomies( array('_builtin' => false),
'objects' );
// get all post types that are assigned to a custo taxonomy
$cpt_att_to_tax = array();
foreach ( $custom_taxonomies as $tax ) :
 $cpt_att_to_tax[] = $tax['post_type'];
endforeach;
$custom_post_types = array_unique($cpt_att_to_tax);


More information about the wp-hackers mailing list