Something like this should work but you haven’t stated where you want to display the CPT pages for games.
function display_games_archive( $query ) {
if ( !is_admin() || $query->is_main_query() && is_post_type_archive( 'portcat' ) ) {
$query->set( 'category__in', 'games' );
return;
}
}
add_action( 'pre_get_posts', 'display_games_archive', 1 );
Related Posts:
- WordPress custom Query for Posts in Category display posts multiple times
- Show a Category Specific Info Box
- Setting Custom Sort Order of Posts within a Category
- Query posts from current year
- How to change the layout and styling of posts according to their category in WordPress?
- Add default content to post (for specific category)
- Show One Category on Post
- Order post by year DESC and month ASC
- Add custom field to category of custom post type
- Do I use custom post type or something else?
- Custom Theme Want To Remove One Category From All Displays
- Display page content AFTER a loop of posts
- How to start with post number x?
- Edit custom post type admin menu link
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- Display post category in foreach loop with category link
- WordPress Custom Fields (Checkboxes with multiple values)
- Most liked page not displaying posts
- How to make number of blog posts a custom field?
- How can i limit the number of posts created per category?
- How can I setup a relationship using categories in WordPress?
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Set Default Category to Username
- Redirect to another page using contact form 7? [closed]
- Display post category in foreach loop
- Dynamically switch template on click
- Can’t get full post title if there a spaces in title
- if in category but only with post meta
- How to call posts under a specific category on static front page?
- Static pages not working
- displaying the categories post
- Adjust the order for returned posts
- Custom Select Query – Selecting the Year?
- Categories Listing and Highlighting current category item
- Get current taxonomy and display query accordingly
- Can I style single post that are in multiple catergories?
- Trying to exclude custom posts based on date, while sorting by custom field
- How Can I Always Display A Particular Post First Using WP_Query?
- AJAX load more posts not using correct category and repeating the same few posts
- Custom post styling per category?
- Show custom post category for single post
- How to run select query of post with category and tags?
- Querying posts from current category, using a variable as array argument
- Add Categories To Custom Post
- Query posts from newest category
- Static text above category page
- wp query custom orderby not custom field
- Custom Select Query pagination not working properly
- Query post category & remove any post id
- Sort post by category using HTML Select tag
- Get first comment link on the post itself
- How can i retrive the movies, trailers, news in a single page using search
- Special Query: Title, Terms, Content – %LIKE%
- Older entries link within a category page
- Add default content to post (for specific category)
- Display ONLY Latest Post From Several Categories
- Display one post randomly from category on home page
- Exclude a ‘portfolio’ custom category?
- Taxonomy Category category.php not working
- Post’s arent displaying
- Only show posts belonging to multiple cateogries at same time
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- Sort Posts Alphabetically Based on Specific Category (Divi)
- I have a website issue I am trying to resolve
- Cant display custom post type posts from a specific category WordPress
- How to display by default only published posts/pages in the admin area?
- Inject post (from specific category) between posts in Loop
- WordPress Delete hook with wp_delete_post function?
- What Defines What Category A Post Picks (if in multiple)
- Delete Post From Front-End and attachment permanently
- Posts are not showing up on particular category
- Creating bulk posts with Youtube videos
- Get user categories with most posts in it
- How i can limit period of post publication?
- Exclude current custom post on single post
- Why Query is returning empty array?
- meta_value timestamp older than now
- Very complex post query
- Delete post revisions only for a single post
- How to add convenient buttons for new custom post statuses
- Display value of custom field at the beginning of a post
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Post is in descendant category not working in home.php
- How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?
- How to get posts ordered by using their categories?
- Different post views for different category views
- How to select a category automatically based on a word in WordPress post title?
- How display related post only in Default category on single
- How to add class to specific navbar item when post parent category is in specific category
- Posts are not displaying on their category and tag page
- Post Category link is same with Page link
- How to delete all posts with dead image urls?
- Get a list of categories that are related to posts
- Creating widget – ask for selecting a post in the admin panel
- How to modify specific parts of a post content in WordPress
- Include post on external custom site
- Is possible to create a custom link that creates a post that’s already categorized?
- How to display subcategory articles in the category view?
- Show posts assigned to multiple categories in current category page
- How to display related posts from the same category?