Permalink slug no longer editable when using post_type_link filter

How can I customize the output and still keep the permalink editable?

The following worked for me:

$post_link = home_url( '/job/' . ( $leavename ? '%postname%' : $post->post_name ) . "https://wordpress.stackexchange.com/" );

I.e. If the $leavename is true, use %postname% in the URL. Otherwise, you may then use the actual post name/slug, i.e. the value of the $post->post_name.

Additionally, I suggest you to use home_url() than hard-coding the site URL into the permalink. 🙂

And I presume you will or have already setup the rewrite rules for the permalinks (/job/<post slug>/ in the above example)?

Even if I remove the custom permalink stuff and only have return $post_link; it still disables editing of the permalink.

I’m not getting that issue, so it’s probably a theme/plugin conflict on your site — try deactivating plugins and enable them back one at a time until you’ve found the culprit.