Based on plugin custom-post-type-permalinks