I can't seem to figure this out from the documentation.
I have a wordpress site with a custom post type called "News"
There are 21 "posts" with data that we are just showing on the root level permalink /news/
However each of those 21 posts have their own page/slug that you can click "view"
This brings you to a blank page because we never built a custom page to show that data... again we are just showing the data on the /news/ and want to keep that.
But we want to disable the actual creating of those pages with each of their own permalinks for SEO purposes..
So, basically I want "/news/the-custom-news-post-that-i-made-example" to redirect to the 404 page.. or not redirect at all.. it just shouldn't exist.
Any help with be much appreciated in advance!
When I set the register_post_type - public to false, or publicly_queryable to false this is not giving me the results I want.. bc then I can't see /news/ anymore either.
Thanks -O
Edit..
Do you mean editing this code... not sure what you mean by your wp-admin..
<?php
add_action('init', 'theyard_news_init');
add_action('init', 'create_taxonomy');
function theyard_news_init() {
$labels = array(
'name' => __('News', 'theyard'),
'singular_name' => __('News', 'theyard'),
'add_new' => __('Add New', 'theyard'),
'add_new_item' => __('Add New news', 'theyard'),
'edit_item' => __('Edit News', 'theyard'),
'new_item' => __('New News', 'theyard'),
'all_items' => __('All News', 'theyard'),
'view_item' => __('View News', 'theyard'),
'search_items' => __('Search News', 'theyard'),
'not_found' => __('No News found', 'theyard'),
'not_found_in_trash' => __('No News found in Trash', 'theyard'),
'parent_item_colon' => '',
'menu_name' => __('News', 'theyard')
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => false,
'capability_type' => 'page',
'rewrite' => true,
'has_archive' => 'news',
'hierarchical' => false,
'menu_position' => 21,
'menu_icon' => 'dashicons-media-text',
'supports' => array('title', 'thumbnail', 'editor'),
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'taxonomies' => array()
);
register_post_type('news', $args);
}