Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP: Adjust the rewrite of a registered post type.
<?php
add_action( 'registered_post_type', 'gs_projects_rewrite', 10, 2 );
/**
* Modify registered post type menu label
*
* @param string $post_type Registered post type name.
* @param array $args Array of post type parameters.
*/
function gs_projects_rewrite( $post_type, $args ) {
if ( 'project' === $post_type ) {
global $wp_post_types;
$permastruct_args = $args->rewrite;
$permastruct_args['feed'] = $permastruct_args['feeds'];
add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%/%project_category%", $permastruct_args );
}
}
@wpsmith
Copy link
Author

wpsmith commented Feb 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment