There is a function called wp_unique_post_slug which is called whenever you save a post. This function contains a filter of the same name that you can use to modify the slug, depending on, for instance, the post type. This example will prepend the slug with the post type, so you can see from the slug which type a post belongs to:
add_filter ('wp_unique_post_slug','wpse420126_change_slug', 10, 6);
function wpse420126_change_slug ($slug, $post_id, $post_status, $post_type, $post_parent, $original_slug) {
return $post_type . '-' . $slug;
}
Related Posts:
- Where is the old post permalink slug stored?
- How to Check if a Page Exists by URL?
- Post slugs and images cannot have same name?
- Change permalinks for post type ‘post’ only
- Pretty URL with add_query_var
- get_permalink returns default link
- how to get permalink using sql
- Why can posts never have a number as the link?
- How to allow slashes in single posts when i click in the edit permalink button
- Post custom permalink results in 404 for archive page
- Some posts returning 404 instead of displaying post
- Custom post type single (permalink) throws a 404 error
- Link for the page archive for posts, like using custom post types with get_post_type_archive_link
- Random post permalink
- What Defines What Category A Post Picks (if in multiple)
- get_permalink executes link without https
- Custom post type permalinks breaking due to 3.1 bug fix
- Create pretty permalink for a post knowing the permalink structure
- Changing my permalink structure – will new layout conflict with existing page?
- Link post permalinks to subdirectory /post
- change default post archive page link
- Remove permalink from images when inserting into post
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- Dynamically generate child-URLs for posts or custom posts
- Adding parent pages to posts
- Plain permalinks not working!
- Changing Permalinks for Default Post type to reflect navigation
- How should I add links to other pages/posts from my post?
- WordPress not opening posts with only numbers if permalink is post_name
- Using permalinks, category slugs, and tag slugs
- Problem with permalink routing?
- Move first half of posts to one parent page, second half to the other page
- How to check a post exist when the permalink has post id in it?
- How to do set post permalinks using 6 digit random unique function?
- Switch to page template when using post permalink
- Trying to use AngularJS with WordPress without any API
- How to handle broken links created by permalink/slug changes?
- Visting slug for ‘post’ post type shows 404 not archive?
- Any way for get_next_post() to use the actual post order instead of publish order?
- how do i add posts-page slug before posts slug in permalinks
- Retrieve post ID from “querying” URL
- hiding permalink in admin if the user is subscriber
- Why does WP_Post not contain its permalink?
- the_permalink() not working in a root installation
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- Second get_permalink inside loop points to wrong URL
- Custom Permalink Structure for Pages & Posts
- register_post_type permalink
- Updating permalink structure using ‘post_link’ filter results in 404 error for posts
- Post is blank when I click on the link
- Custom permalink for each post
- Post/page title to permalink transformation – what is behind the scenes?
- When WP_Query only returns 1 post, how do I automatically redirect to that post?
- Post titles and thumbnails as links to custom post types?
- Making posts permalinks consistent numbers
- Can Permalink structure of %postname%/%post_id% improve performance
- How to link post titles on page A to its posts on page B?
- Categories Listing and Highlighting current category item
- Standalone form does not post to the url when form fields are populated (otherwise it does)
- Changing permalink of WordPress
- Set Default Post as Parent Child (Nested) Relation
- How can I add random alphabets in wordpress permalink posts structure
- Remove subcategory slug from url
- Can I show category name in url for only one of my categories?
- Please help a newbie with blog page issue?
- My post permalinks are redirecting to the post archive page for some reason?
- How can I make a post sub link?
- How do you change the permalink for posts for a single category?
- Private post caught in endless redirect loop
- WP posts using index.php instead of single.php
- How to add a ‘News’ section to specific posts in WordPress
- Add a url parameter to the current post and read it in a shortcode
- How can I set the permalink of an article / page equal to the permalink of an existing article / page?
- How to add category base prefix to wordpress permalink
- Category URL to use same string as Post URL Permalink
- Permalink base only for posts
- Change the URL of posts by category
- Point users to a specific url directory for some posts
- Precedence of page permalinks over woocommerce product category links?
- Post & Category Archives URL structure
- post_name is not stored until post is published… where should I store my slug until it goes live then?
- Use a custom post URL that is outside the blog root directory
- Change link to permalink inside post content
- One of my posts is displayed as page
- Make assigning post to a specific category equivalent to assigning it to all categories
- Modifying the permalink href for posts with jquery
- How to display subcategory articles in the category view?
- Change posts URL [duplicate]
- How can we pass a value from the_permalink() at WordPress?
- After the local installation of an old WP website I can see the homepage but I can’t access to the articles, why?
- Default post type doesn’t display in url
- How to change Permalinks only for Blogposts
- Permalink structure for two separate blogs
- Blog posts are not appearing as subs of Blog Page
- How can I fixe the article title problem?
- How to add paraent in Blog post URL in wordpress
- Change permalinks in posts via SQL
- Why can posts never have a number as the link?
- Modify Post URL Programmatically
- Custom permalink for ‘post’ not working