Make a function to run only for CPTs

Before returning it’s result, get_permalink() applies one of 4 filters on the permalink it has generated, depending on the post_type of the post in question:

  1. post_link, when post_type == ‘post’
  2. page_link, when post_type == ‘page’, via get_page_link()
  3. attachment_link, when post_type == ‘attachment’, via get_attachment_link()
  4. post_type_link, when post_type is not one of the above (i.e., a CPT), via get_post_permalink()