There are many solutions for that..
1. .htaccess rules
You can put some redirect rules in your .htaccess file:
RewriteRule ^(.*)\-staff/$ /staff/? [L,R=301]
// some other rules
2. Using WordPress hooks
function my_redirect_function() {
global $wp;
if ( preg_match( '@staff/?$@', $wp->request ) ) {
wp_redirect( get_post_type_archive_link( 'staff' ) );
die;
}
// ... put other rules in here
}
add_action( 'template_redirect', 'my_redirect_function' );
3. Using Redirection plugin
You can use that plugin and define custom redirects based on regular expressions.
Related Posts:
- Redirect after deleting post and keep track of pagination
- Unable to get wp_redirect() working after adding a CPT via the front end
- Multiple portfolios and single item in two of them (ideas?)
- Redirect 404 page with ID in slug to associated page with same ID in slug
- Why does not this wp_redirect work in is_single()?
- Custom URL redirect in WP
- How to access the thank you page from the single post?
- Redirect User From Registration Page To CPT (profile page) with custom url
- Redirect to URL if x number of days passed
- Redirect users in first login to a dynamic link
- wp_redirect to file:// location results in blank page/cannot be displayed page
- Redirect drafted post of custom post type to URL?
- Redirection after saving a post
- Full RSS feeds for Custom Post Types
- archive as a page, so that it can be added in the wp_menu_nav
- custom post type problem
- Can’t add text in front of shortcode
- Custom Permalinks for Custom Post Types
- Creating separate feeds for custom post types
- Displaying Custom Posts
- Displaying multiple post types on home page
- Category Icon on custom post type
- Prevent custom post type from showing up in custom menus
- How to do admin CRUD & Pagination
- looping though custom post types and only return results in a given taxonomy
- display custom taxonomies limited to custom post type?
- Allow front end users to add data to a custom post type
- custom fields cannt be seen with version 3.1
- Displaying custom post types as a gallery
- Get_the_terms restrict output
- Populate a custom field dropdown with post titles by author
- Can I query posts by taxonomy conditionally based on post type?
- Shortcode leaves no space for other elements?
- Can anyone clarify difference between archive-{posttype}.php, type-{posttype} and date.php?
- Conflict between wp_list_pages and get_posts – list pages not displaying
- User-submitted reviews of different custom post types
- How to make a pulldown menu display custom meta terms in a theme?
- After creating custom post type, URL to custom posts are invalid
- Custom post type index (maybe using get_template_part)
- Custom post type menu
- Listing all slugs?
- How can I merge this function(s) that inserts terms to a custom taxonomy with this other that adds a custom taxonomy filter?
- What would be a proper name for a custom post type created for static content?
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- Custom fields not saving in newest WordPress 3.0.1
- How can I display a drop-down select of Post Names
- Which file/template is in charge of taxonomies for custom post types?
- Implementing Pillar Posts; Long Posts yet with Some Page-Like Handling?
- get_post_types – exclude multiple post types by name
- Address as a content type post
- CPT Columns doesn’t show categories
- Custom post type loop with custom category filtering
- Hide Status Option From WordPress Publish Metabox and Rename Published on:
- Check if user has comment on current post
- How to conditionally add Custom Post Type to Front Page
- Role capabilities issue
- Assigning a category to a custom post type in WordPress
- Insert Custom Post Types
- How to inherit field value from parent post into in child / sub post
- Create field of Custom Post Types
- Dynamically insert code to custom post type loop
- how to show records that don’t have custom meta value
- How can I add a shortcode to query Custom Post Type with ACF in WordPress?
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- Show current custom taxonomy
- Template for custom post type when taxonomy is in the URL
- finding and using post type fields in WordPress
- One Custom post type 404’s others don’t
- sortable columns for multiple custom post types not working
- Why WordPress is picking archive.php instead of page.php?
- I need to add a filter to prepend the term ‘National – ‘ to the post title if the post is tagged to multiple states
- post_type_link Filter – Too Few Arguments
- Custom ordering of CPT items not matching with the ordering of its pagination
- Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
- how to get this tax_query working?
- How can I trace inconsistency in loading a template?
- Custom Post Type page sorts differently on different environments
- Select2 AJAX and WP Query Returns ALL and does not filter
- Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?
- Custom Post Type posts, conflict with posts after add_rewrite_rule to top
- hide specific div on single.php [closed]
- Is there a way to create two template for single custom post type page?
- Custom Taxonomy Search result page
- How to insert data into meta box from another plugin?
- Changing slug of all posts
- WP_Query orderby not work with meta_key
- How exclude or skip post type with get_next_post_link
- Share root slug for Child Page and Custom Post Type (prioritizing child pages over posts)
- How check if a post is saved from backend or frontend?
- Exclude Custom post type from /blog page
- Custom Permalinks For CPT and pages with parent. Advanced WordPress
- Stores category posts in an array
- echo selected value from dropdown
- CPT is simply not displayed in the main archive with “pre_get_posts”
- How to group search results by post type and only if post type result is not empty?
- How to change base in tag URL for custom post type, to not use “Custom Structure” set in Permalinks setting?
- How to integrate single and archive templates for custom post type in any WordPress theme
- set_query_params using custom params defined in functions file?
- Custom shortcode works in Elementor editor but not on frontend
- Having Issue on Ordering CPT by Custom Field In Custom WP Query