I’ll gather together some potentially useful things here as I think of them…
Change post type defaults
Ok, so say you want to do something different than has been declared with the default CultureObject post type. So for example – what if you have an archive or a library and want to display something other than an “object” in the URL?
In that case you’ll want to use the register_post_type_args hook to change the default CultureObject behaviour.
Here’s an example where we change the slug to ‘archive’ (so instead of yoursiteroot.com/object/some-object-id, your record would be at yoursiteroot.com/archive/some-object-id):
// Function to amend CultureObject permalink
function thirty8_gp_cultureobject_permalink( $args, $post_type )
{
// If not objects CPT, bail.
if ( 'object' !== $post_type )
{
return $args;
}
// Add additional CPT options.
$object_args = array(
//'has_archive' => true,
//'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'page-attributes' ),
'rewrite' => array('slug' => 'archive'),
);
// Merge args together.
return array_merge( $args, $object_args );
}
add_filter( 'register_post_type_args', 'thirty8_gp_cultureobject_permalink', 10, 2 );