mercredi 28 janvier 2015

Custom Post Type as Page parent


So there are a million snippets for how to get pages as parents of custom post types.


However, the reverse seems to be questionable. One would think, since everything in WordPress is technically a "post", this would be trivial. However, it is not.


Thus far, I have:



add_filter( 'page_attributes_dropdown_pages_args',
function( $dropdown_args, $post = null ) {
$dropdown_args['post_type'] = 'portal';
return $dropdown_args;
} );


And sure enough, pages now allow for me to select portal-type posts as parents. The URLs do seem to register correctly within wordpress, though they all 404.


How can I get wordpress to understand this hierarchy and load the pages that have posts as parents?





Aucun commentaire:

Enregistrer un commentaire