Skip to content

Instantly share code, notes, and snippets.

@Kevinci
Created February 3, 2016 07:06
Show Gist options
  • Select an option

  • Save Kevinci/0590547e7e07a33bde54 to your computer and use it in GitHub Desktop.

Select an option

Save Kevinci/0590547e7e07a33bde54 to your computer and use it in GitHub Desktop.
function custom_post_type_link($permalink, $post, $leavename) {
if (!gettype($post) == 'post') {
return $permalink;
}
switch ($post->post_type) {
case 'slug':
$permalink = get_home_url() . '/' . $post->post_name . '/';
break;
}
return $permalink;
}
add_filter(
'post_type_link',
'custom_post_type_link',
10,
3
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment