Hi - working on moving some existing code in a site. Please forgive the PHP newbie question. I have this function:
function cc_remove_cpt_slug( $post_link, $post, $leavename ) {
if(in_array($post->post_type, array('toronto','calgary','edmonton','halifax')) ) {
$post_type = $post->post_type == 'toronto' ? 'toronto' : $post->post_type;
$post_link = str_replace( '/' . $post_type . '/', '/', $post_link );
return $post_link;
} else {
return $post_link;
}
}
add_filter( 'post_type_link', 'cc_remove_cpt_slug', 10, 3 );
Can someone please explain what line 3 does?
$post_type = $post->post_type == ‘toronto’ ? ‘toronto’ : $post->post_type;
Thanks