How can I change the page that the ‘view’ action links to on the list post screen for a custom post type?
Update
I’ve got it to work with normal post types using the below code but where do I define the custom post type?
function change_link($post_url,$post) {
return '/video?id='.$post->ID;
}
add_filter('post_link',"change_link",10,2);
By adding a filter to the
'post_link'
hook. See theget_permalink()
function for more info.For custom post types, you can use the
'post_type_link'
hook.It’s a lot easier if you follow the source code (this is for v3.0):
Based on the update of your question: