I have set up two custom post types (show & podcast) and I have parented podcast to show by following this awesome tutorial: https://1fix.io/blog/2016/02/05/parent-from-another-cpt/

The rewrite rules are working perfectly, but my permalink still shows %show% in the url when I'm editing my podcast like so:


Here is my rewrite code:

add_rewrite_tag('%podcast%', '([^/]+)', 'podcast=');
add_permastruct('podcast', 'podcast/%show%/%podcast%', false);

With this code, I can see the page with /podcast/whatever-I-want/podcast-name and it works beautifully.

Here is my post_link_type filter function:

function mySite_post_link_type($permalink, $post){
    if($post->post_type == 'podcast') {
        $parent      = $post->post_parent;
        $parent_post = get_post( $parent );
        $permalink   = str_replace( '%show%', $parent_post->post_name, $permalink );
    return $permalink;
add_filter( 'post_link_type', 'mySite_post_link_type', 10, 2 );

This should be updating my permalink correctly but it's not. I've tried flushing my cache, saving permalinks, etc., but it still appears on my permalink.

Do I need to adjust the priority? Am I missing something?

Thanks for any help.

1 Answer 1


Rename post_link_type to post_type_link


  • LOL I cannot believe that was it! Apr 5, 2018 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.