I want to customize the output of the permalink for a custom post type, but I want the permalink to still be editable when editing a post. I'm using the post_type_link
filter:
add_filter( 'post_type_link', function( $post_link, $post, $leavename, $sample ) {
if ( 'job' == $post->post_type ) {
$post_link = 'http://localhost:8888/testsite/job/' . $post->post_name . '/';
}
return $post_link;
}, 10, 4 );
When this filter is active, it no longer shows the "Edit" button next to the permalink when editing the post. Even if I remove the custom permalink stuff and only have return $post_link;
it still disables editing of the permalink.
How can I customize the output and still keep the permalink editable?
job
, then the default permalink structure should bejob/<post slug>
, so why are you manually customizing it via that filter?