x
15
15
1
function cambia_slug_por_id($post_link, $post = 0) {
2
if($post->post_type === 'incidencias') {
3
return home_url('incidencias/' . $post->ID . '/');
4
}
5
else{
6
return $post_link;
7
}
8
}
9
add_filter('post_type_link', 'cambia_slug_por_id', 1, 3);
10
11
function rewrite_post_id(){
12
add_rewrite_rule('incidencias/([0-9]+)?$', 'index.php?post_type=incidencias&p=$matches[1]', 'top');
13
}
14
add_action('init', 'rewrite_post_id');
15