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
- How to check a post exist when the permalink has post id in it?
- CPT archive redirects to single post
- Show posts by a custom post author
- After database migration, posts not showing up in dashboard
- Custom loop pagination links not working
- Prevent Delete Attachment by URL or When Submit
- Enable Comments Box On Custom Post Type
- wp-cli post create & media import issues
- How can i limit the number of posts created per category?
- Search results posts_orderby and ID
- How to do set post permalinks using 6 digit random unique function?
- Getting Custom Post Loop to display in Bootstrap 3 column grid
- Turn On Comments On Custom Post Types in Directory Theme
- WordPress custom Query for Posts in Category display posts multiple times
- Responsive images with custom image size
- Making a custom Pagination for multi page blog post
- ERROR: Your feed is invalid (after update WP4.7) in custom types
- Switch to page template when using post permalink
- Editing the default page to show all posts, rather than most recent ones
- Unable to restore from backup – how to obtain old blog posts?
- Trying to use AngularJS with WordPress without any API
- Automatically add date to the auto generation of post slug
- How to handle broken links created by permalink/slug changes?
- Add Read More Tag to a post content (Single.php)
- Permission issue with custom post type – not added to menu – by plugin
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- Take a received feedback item, turn it into a post
- Getting value from get_post_custom
- WP Admin register taxonomy and post type performance
- Add a custom meta box in the post options that loads some html code in the header
- Static posts page with home.php
- Any way for get_next_post() to use the actual post order instead of publish order?
- If in_category not working for multiple single.php pages
- Calling Different Custom Post Timestamps in a table
- how do i add posts-page slug before posts slug in permalinks
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Admin – create custom post status and display above table
- custom post template file not shown, instead all the time 404.php
- Set Default Category to Username
- How to allow visitors to filter posts by multiple taxonomies
- show custom post type category dropdown sorting result on same page
- Custom Post Type Rewrite To Include Parent Page(s)
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- Retrieve post ID from “querying” URL
- Thumbnail & Category link aside post
- 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
- Single.php – Get Current Parent Category
- Permalink misbehaving in Custom Post Types
- Insert sometext after first h3 in content
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- How to include my own css in post
- Custom post types related to same custom post type?
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- Dynamically switch template on click
- How do I Redirect a WordPress Page?
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- Thumbnail Image to go in the post aswell
- Add get_the_tags() to Single Posts section via functions.php
- Customize rel=canonical tag for single blog post
- a little direction on custom post type
- disable Tab post on nav-menus page (Admin)