I have a couple custom post types registered = Staff, Properties
If I have a page with the slug archive-staff
, how can I automatically redirect that page to the Staff CPT archive page with a php function?
This should also work for any page that starts with “archive-“, automatically redirecting to the archive of any registered custom post type that matches the 2nd word of the slug.
So the custom archive-staff page would redirect to the Staff CPT archive page.
The custom archive-properties page would redirect to the Properties CPT archive page.
…and so on for for all custom post types only if their corresponding custom page exists.