The solution is to reregister the default post type just after WordPress, and to add a rewrite slug. Also, the _builtin param needs to be set to false.
add_action( 'init', 'my_new_default_post_type', 1 );
function my_new_default_post_type() {
register_post_type( 'post', array(
'labels' => array(
'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
),
'public' => true,
'_builtin' => false,
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => array( 'slug' => 'post' ),
'query_var' => false,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
) );
}
Related Posts:
- Using single.php from plugin folder instead of default template folder
- Pretty URL with add_query_var
- get_permalink returns default link
- Custom post type single (permalink) throws a 404 error
- Custom post type permalinks breaking due to 3.1 bug fix
- Dynamically generate child-URLs for posts or custom posts
- Changing Permalinks for Default Post type to reflect navigation
- Move first half of posts to one parent page, second half to the other page
- Custom Post Type – Category Rewrite – Remove Rewrite from Sitemap
- Duplicate Custom Post Type and Taxonomy Slug
- How could I change my Permalink from blog to custom structure? [closed]
- Visting slug for ‘post’ post type shows 404 not archive?
- Is it possible to customize the post according to post format in single.php?
- register_post_type permalink
- Post titles and thumbnails as links to custom post types?
- Custom Post Type, post-formats associated to custom post type > 404 archives
- add_rewrite_rule and template redirect not working
- Can I style single post that are in multiple catergories?
- Changing permalink of WordPress
- Remove subcategory slug from url
- My post permalinks are redirecting to the post archive page for some reason?
- 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
- Prevent Archive URLs
- Custom Post Types and Broken Permalinks
- How to add category base prefix to wordpress permalink
- Permalink base only for posts
- Append a random string to a post permalink
- Fixing the WP Post Object for Custom Route
- Custom Single Post Type not referring to single-post-type.php File
- Posts in Page – How to customize the URL?
- Use a custom post URL that is outside the blog root directory
- Overwrite URL on blog posts
- Default post type doesn’t display in url
- Changes done in admin panel are taking time to reflect in the REST api responses
- Blog posts are not appearing as subs of Blog Page
- Add a checkbox to post screen that adds a class to the title
- How to automatically generate a unique random slug
- delete post also attachments
- How do I create a featured post within a custom post type?
- Static posts page with home.php
- Delete Post Link to delete post, its meta and attachments
- Single.php Active Category Class
- Link for the page archive for posts, like using custom post types with get_post_type_archive_link
- How to edit wordpress RSS feed to show post title only
- Random post permalink
- Add custom fields to post programmatically
- Is it possible to have two different previews of a post (ie. two templates for one post)?
- Disable single post page
- how to know if the post has pagination () or not
- Filter Posts By Tag
- Custom Post Templates
- Adding parent pages to posts
- Set terms in a custom post
- I want to display custom text widgets for each post in the sidebar?
- Enable Comments Box On Custom Post Type
- How can i limit the number of posts created per category?
- Trying to use AngularJS with WordPress without any API
- how do i add posts-page slug before posts slug in permalinks
- Admin – create custom post status and display above table
- the_permalink() not working in a root installation
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- Customize rel=canonical tag for single blog post
- disable Tab post on nav-menus page (Admin)
- Second get_permalink inside loop points to wrong URL
- Multiple comment forms on a single page
- Best Way to Add UnEditable HTML to Posts
- Is codex right on deleting post?
- Post is blank when I click on the link
- l accidentally permanently deleted a Draft. There’s any way I can recover it?
- Get a term each custom post type
- Nest Next and Previous in a href with class that has a background image
- Can Permalink structure of %postname%/%post_id% improve performance
- Getting post and attached image from subdomain
- Help on conditional statement to accompany wp_insert_post function please?
- Search results for ACF data
- Private post caught in endless redirect loop
- Redirect to custom post if custom archive page has just one result?
- Multiple posts in one page
- How to make “single post” permalink maintain it’s sub-page structure
- delete post hook not being fired when deling in wordpress dashboard admin
- Is it possible to make a custom post that adds multiple pages?
- Slug collision between page, taxonomy and custom post type
- Custom post styling per category?
- List posts of assigned categories in list of all categories on single.php
- Is possible to do this from function.php
- Hook To Get All Posts Deleted
- Custom URL Structure for posts with subcategories
- How to show the posts list into a static page? Problems to use the loop into a static page
- Allow users to create their own page/s
- 404 for some custom taxonomy not ALL taxonomy
- WordPress strips some attributes for author posts
- Deleting first four characters from all Post Titles
- Deleling wordpress posts permanently still have IDs
- Post’s arent displaying
- Can I get custom post items in select box (dropdown)
- How to have 2 posting pages on a blog
- Dynamic Menu Item
- I have a website issue I am trying to resolve