Skip to content

Instantly share code, notes, and snippets.

View giankocr's full-sized avatar

Gianko giankocr

View GitHub Profile
@giankocr
giankocr / remove-custom-post-type-slug.php
Created September 30, 2017 17:30 — forked from elpuas/remove-custom-post-type-slug.php
Remove Custom Post Type Slug
/**
* Remove the slug from published post permalinks. Only affect our custom post type, though.
*/
function languagecorps_remove_cpt_slug( $post_link, $post, $leavename ) {
if ( 'countries' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );