Last active
November 14, 2021 10:52
-
-
Save brianleejackson/344b1df13cda62c2ade96a37b2da93bb to your computer and use it in GitHub Desktop.
Alternative way to remove the base slug from custom post type URL. Source: https://woorkup.com/wordpress-custom-post-type/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bis_remove_cpt_slug($args, $post_type) { | |
if(in_array($post_type, array('artist'))) { | |
$args['rewrite'] = array('slug' => '/'); | |
} | |
return $args; | |
} | |
add_filter('register_post_type_args', 'bis_remove_cpt_slug', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment