Not tested, but if I have inderstood the question correctly, please try the below solution. Articles post type will return a 404 but posts under movies categories will not.
Code goes in a functions.php of your child theme.
function rr_404_custom_post_types()
{
global $wp_query;
if (is_single() && !($wp_query->post->post_type == 'movies')) {
$wp_query->set_404();
status_header(404);
}
}
add_action('template_redirect', 'rr_404_custom_post_types');
Related Posts:
- Is it possible to request several post types from a feed?
- What is the meaning of the various post messages?
- wp_list_filter() and supports
- What does get_current_screen() do?
- Post types – Normal Post – Image
- WordPress register_post_type Invalid post type
- How to edit default post settings
- Check If post id exist in custom post type , outside of loop
- Conditional based on post meta
- Querying for multiple post types in SQL
- Displaying only the current category in template page
- How to get all CPT names into WP_Query ‘post_type’ parameter?
- Show post type taxonomy
- wp_dropdown_pages() returns empty string for post type anything other then page
- Target Post Type from array Query
- custom post type conflicting with othere hierarchical and archive in wordpress
- What are custom_css and customize_changeset used for?
- Per Post Type Revision Numbers
- Get list of all registered post types slugs
- WP_Query ignores post_type in category view
- How do I create a link that will always show the latest post?
- How to get only posts, pages and custom post types in WordPress
- Exclude top-level pages from search results
- How to get attachments for a specific post type?
- custom post types don’t appear in RSS
- What is the difference between “post” and “page” in WordPress?
- Gel all image from certain post type
- Including post_type = ‘wiki’ in author archives
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Twillio How To Send SMS for Custom Post Type
- Is It Possible To Have Shared WordPress Custom Post Types?
- Show all parents and children in custom post type in right order
- Resolved – category-slug.php not working after wordpress migration
- How to output content based on same custom taxonomy?
- How can I filter block registration based on post-type? (Block alignment settings)
- How do I search inside specific taxonomies in WordPress
- How to retrieve a custom post’s capability?
- Custom dashboard menu does not stay open for the custom Taxonomy within it
- Use get_post_types to query only custom posts types
- Move value from one meta key to another
- How to display get_post_type() translated?
- how to fetch the meta field keys/meta boxes from a post type?
- How do I set default meta value by post type?
- Default ‘post’ post type archive slug?
- How to define which register_post_status goes to which register_post_type?
- Is it possible to filter the display name for post formats for display in the Formats meta box?
- How to Set Taxonomy Object Description?
- Show only public custom posts in home page
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- wp_list_pages() refuses to output posts
- Post type no single page
- get_post_types – exclude multiple post types by name
- How to loop custom post_type from (a) specific category(ies)?
- Custom post type and standard post not displaying or working
- determine whether content is of type Page or a Post and display accordingly
- How to check if it’s edit.php & post_type is set?
- Pass PHP through redirect and custom fields
- Custom post type in theme not appearing
- How to copy a custom field from the user’s CPT to the user’s normal posts
- Post types translation
- Custom wp_query differs on index page and category page
- Add filter to Admin list for all custom post types by their custom taxonomies
- Sort query output on taxonomy term archive by post type using pre_get_posts
- Walker_Nav_Menu creating too many closing tags?
- “Revision” records in wp_posts have original post type instead of “revision”
- query_posts doesnt show pages with given ID when post_type => page
- How to hide list from custom post type
- Target only single product page
- Error in Fetching Custom Post Type parent Category URL (slug)
- How do I make the comment disappear after deleting from the database?
- Custom Post Type Single Page is not working
- WordPress private post won’t display to other admins
- Unique IDs for Post Types and Taxonomies
- How can I get the content of the current page in my loop while merging post-type
- custom post type single page not found after aotumatic publish By the author’s robot
- Custom slugs for Each Tab
- Permalink like example.com/taxonomy/post_type/postname
- google index an Post type page I do not want
- Display taxonomy loop using custom field data
- Load custom post template
- Change Custom Post Type to Post + Category
- WordPress delete mysql rows with string
- How can i order my posts by post type?
- Permanent Custom Post Type
- Post types showing tables…Can I do that?
- custom post permalink
- Adding featured image to post display widget
- Get_posts not returning any posts when used with switch_to_blog
- Issue attempting a wp_query_posts with tags
- Taxonomy template by post type
- How to Display Child Taxonomy Posts
- How to show metabox key to custom post?
- Add a tag like a post
- How would I get a list of posts from a custom post type
- How can I make a custom post type that loops pages in a new dashboard page, each single page is a new dashboard page (all within the back-end)?
- permalink and $_GET
- How to batch convert comments to posts?
- How to add post type in masonry posts elementory widget
- Show a featured image with “Link” Post Type?
- WP_QUERY with both author and post_type set (makes me crazy)