I don’t think you need a redirect. You are missing the rewrite rule for your custom post type.
register_post_type('cp_clients', array(
'labels' => array(
'name' => __('Clients'),
'singular_name' => __('Client')
),
'public' => true,
'has_archive' => true,
'supports' => array('thumbnail', 'title', 'editor')
'rewrite' => array('slug'=>'companies')
);
You should now be able to create and use single-cp_clients.php, and archive-cp_clients.php template files. And your urls will look like example.com/comapnies and example.com/comapnies/acmecorp
Related Posts:
- Loading External Scripts in Admin but ONLY for a Specific Post Type?
- register_post_type sort order by title by default
- Custom post types – Use post_id in permalink structure
- Rewrite custom post type rss feed links
- Populate Taxonomy from Custom Posts
- Show related posts on single page by custom taxonomy on custom post
- Exclude from search all custom posts which are NOT in a taxonomy term
- Remove unwanted part of permalink custom structure from CPT url?
- Changing a custom post type “has_archive” after registered
- Same base slug for CPT post and CPT taxonomy terms
- how to make custom posts sticky? [duplicate]
- Custom Post Type, Two categories, Two columns with Pagination
- wp_insert_post custom taxonomy
- Parent page for CPT
- Unable to get wp_redirect() working after adding a CPT via the front end
- Post Link Filter Help [closed]
- Custom Post Type slug same as page name causing a conflict
- Custom Post Type “Event” with custom permalink structure
- Getting a “Changes you made will be lost” dialog prompt on a custom post type page
- Why is my custom loop not filtering correctly nor paginating?
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Custom post types with custom directories
- How to associate two different post types (think Book and Chapter)
- Different Archive and Single Permalink URL
- Separate comment section for post type in dashboard
- GravityForm: Populate Dropdown with custom post type [closed]
- Need to display same custom post type on 2 different singles templates
- Add post_type to index.php
- submenu item edit a specific post
- Confusion regarding Nonce & using it in Custom Columns for Saving Checkbox Value to Post Meta
- CPT Group by Date metabox Value
- How to add a custom taxonomy to show up in a custom post type menu?
- Replace text in post from cvs
- Admin search ACF relationship
- With two custom post types, how to make one a child of the other in the admin menu?
- Get parent categories of custom post type
- Advanced or not so advanced pre_get_posts query
- Custom date changer post_date => future – missed schedule error
- Selecting a post in Dashboard
- WordPress sort search results by custom order
- Can one create multiple Custom Post Types with a for loop?
- CPT Validation to not show “Post updated.”
- Translating custom post type metaboxes [closed]
- How to change permalink to include custom post type
- Listing all term items alphabetically / sorting loop
- save_post custom post type ? $_POST not working?
- Single page not working for custom post type
- How to make WP_Query not to show irrelevant posts?
- Load Next WordPress Posts With AJAX?
- Two column layout with alphabetical ordering
- Custom post type index (maybe using get_template_part)
- Custom post type menu
- Implementing Pillar Posts; Long Posts yet with Some Page-Like Handling?
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- Return number of all custom posts type by author in all statuses
- Custom Post Type “MUST NOT” be able to search via URL
- How to organize custom post type list by year?
- How to add and display custom content that is not a post
- List latest post out of 2 custom post types
- Ideas to connect external database table to wordpress posts as custom field source
- CPT structure questions
- Adding custom post formatting options in custom post types
- All in one calendar custom post type query doesnt work as expected
- Better in the long run to use post date or custom taxonomy to sort/separate posts by year?
- Navigate by Tags inside a custom Post Type
- One Custom Post Type two different Templates
- add_filter get array data before display in custom post_type
- On click some element i want to use some template
- WordPress Custom Post Loop
- programmatically generated custom post type is created more than once
- Remove custom taxonamy slug with pagination
- Button link display in shortcodes using custom field in ACF
- Peepso: Add extra data field (custom post meta) to postbox
- Create posts inside CPT post
- wp delete duplicate entries of custom post types every 15 minutes
- How do I link to a dynamic ACF button from a Custom Post type?
- Hook create / update post
- How to hide sub fields in a field group and also the entire field group if the answer selected is “no”
- Show Post columns to specific users on condition
- Taxonomy to Post Type. Every Taxonomy Item can be Producer or Developer
- Custom Taxonomy – fields
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- How to use costum database table for custom post type
- connect users to Custom post types
- Making my custom column sortable
- do action inside a class is not working
- Create an additional template page for every term taxonomy
- Custom Post Type Not Displaying Correctly
- How to solve performance issue caused by custom post type overview with 20k+ custom taxonomy terms
- Custom Post Type Pagination Not Working or Single Posts Displaying?
- Query Distinct Taxonomies of Custom Post Type
- Excerpt for each post type and for is_front_page
- Show taxonomies from specific CPT
- Custom metabox value not saving
- Category / Custom Post Type permalink issue
- How do i make a listing page of custom post type?
- How to add post type in masonry posts elementory widget
- strange conditional tag behaviour [duplicate]
- Comments are not working on Custom Post Type
- Post object GUID adding http:/