Modify built-in post type properties

This is a pretty late answer, but I was looking to do something similar and figured it out. I wanted to get nav_menu_items into an RSS feed, which required changing the built in nav_menu_item post type property publicly_queryable.

Anyway, it was actually pretty simple, here’s a generic function to do it:

function change_wp_object() {
  $object = get_post_type_object('post_type');
  $object->property = true;
}
add_action('init','change_wp_object');

And that’s it. I’ve got it in a plugin. If you want to see the list of available properties to change, throw in

echo '<pre>'.print_r($object, 1).'</pre>';

to get a nicely formatted output of all the properties.

In your case you’d use

$object-> hierarchical = false;

Hope that helps someone!

Leave a Comment