#deletePostType #reset_url #wordpress #wordpress_permalink #permalink_problem
Problem was i register a post type which named 'news'. But i want to create a page using this slug and '/news url' but this url show me the news archive page by default. for this case I decide to change the post type slug news to 'news-event'. and create a page which slug 'news'.
But the problem is still alive after delete the change/delete the 'news' post type...
here I share how to delete a post type with code and update the permalinks from "settings/permalinks"
Delete post type:
function custom_unregister_theme_post_types() {
global $wp_post_types;
if ( isset( $wp_post_types["news"] ) ) {
unset( $wp_post_types[ "news" ] );
}
}
add_action( 'init', 'custom_unregister_theme_post_types', 20 );
Update Permalink Settings:
first set Numeric and save then again set Post name and save again.