You should mention register function in your Question.
Add flush_rewrite_rules( false );
in Your custom_post_type register function. it is necessary when you are creating custom post with archive.
example code:
function create_my_post_type(){
register_post_type('MyPost', array(
'labels' => array('name' =>__('My-custom-Post'),'singular_name' => __('my-post')),
'rewrite' => array('slug' => 'MyPost','with_front' => true),
'public'=>true,
'has_archive' => true,
));
flush_rewrite_rules(false); //recreate rewrite rules.
}
add_action('init','create_my_post_type');
Related Posts:
- How to target with css, admin elements according to user role level?
- “wp_enqueue_style();” don’t load new edited style
- Best way of adding CSS which can be manipulated by the user via theme option panels?
- Need help on WordPress and php
- Multiple pages on one with different HTML
- WordPress Customizer not setting default value upon initial install?
- wp_enqueue_style with style.php and WordPress functions
- Minify HTML, CSS, JS with PHPWee?
- Archive dropdown styling not applied
- Different background-image by category
- Add a Different CSS Class Into The Body Tag of Different WP Pages
- WordPress override bloginfo variable
- Shortcode content output but not in correct place
- Displaying theme options in css
- Show post in slider
- Add a custom stylesheet for BlackBerry
- How can I hide Home in my menu in a specific page?
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- how to remove metadata from the posts of my blog?
- Is there CSS to expand the gallery limit on Index Pages?
- How to add condition in wordpress loop? [closed]
- Css loads very slow [closed]
- Different post styles depending on category
- How create a Shortcode with hover and complex options
- WordPress Multiple Navigation bars
- two columns of posts on homepage, one of them “favorites”
- Which is the correct way to conditionally enqueue a CSS file?
- Custom Background by Page IDs
- Change CSS based on is_user_logged_in
- Add class to DIV depending on page loaded
- Liking a facebook page from wordpress website?
- trouble with page_id & highlighting current page
- wordpress admin plugin menu custom css
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Where can I find the inline-css of my theme header?
- Menu Custom Data Attributes
- Highlight the links without using dropdown
- How to modify mobile nav menu text in theme
- Website completely messes up when logging out
- Issue Enqueueing WordPress style.css
- Dividing the loop to style post differently
- How to add new CSS file to new PHP file
- wp nav menu: show submenu below li item
- Styling an “active” link outside of WordPress default menu
- I get “Cannot modify header information – headers already sent” when I change my theme
- How to edit background color of only one sidebar?
- How to sort posts by active category in WordPress?
- Timber right sidebar in WordPress theme
- How to find which .mo file is responsible for displaying a particular localized string?
- How to Remove Theme Style CSS inside Custom Plugin?
- Add css class to string
- Removing links from Grouped products
- Add other class content with reference class value
- WordPress custom php script to match standard page layout
- Adding Custom css file in the wp-uploads directory with custom php functions
- admin panel – How to remove “delete” button from category editing page
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- Cannot dequeue Elementor Font Awesome css
- How to find and delete a menu item in php?
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- WordPress Slider is not working
- Hide author from search results meta, still display date and categories
- How to locate parent theme functions and add functions to my wordpress child theme?
- Add my footer menu to the header
- Add Shortcode to ::before class
- Make a full-width wordpress page
- Bring Font Awesome icons inside menu A tags
- Trying to add get_the_title hook to this line
- How to display post_content from database in different on template page?
- Displaying POST content with HTML tags and all
- remove blank space where sidebar was
- Display specific main Sub Nav on Woocommerce product pages
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- Highlight Single Page Ancestor
- Custom Thumbnails [closed]
- Relative post date in recent posts list
- Widget edit and add in any page
- Styling admin page rows in order of importance (checkboxes)
- Why isn’t my link attribute getting my css?
- How to save the output of php variables used in inline css code to the main style.css?
- wp add inline style in loop
- featured post as div background
- Combining fancybox with multiple thumbnail plugin
- Display pages from specific page template
- Trying to customize wordpress drop down categories
- Show Nav Link To Users Signed In
- Sidebar doesnt get updated?
- PHP Puzzle: Unique Styles with PHP loop
- How to use plugins_url() inside PHP stylesheet file [duplicate]
- Load files content [closed]
- Integrating CSS Into a WP Function Call [closed]
- WP_Query not returning results
- Predefine Magazine Style Layouts
- Add a “Next Post” & “Previous Post” styled button manually to a post
- How do I link the side images?
- How to create a container in php then customise it in CSS
- hello can you advise how to fix the error?
- inner-wrap div pushing custom table far down on page
- Styling best practices for single pages/templates
- How to create different templates for woocommerce single-product.php?