Try adding to functions.php
function filter_movies( $query ) {
if( !is_admin() && $query->is_main_query() && $query->get('post_type') == 'movie') {
$tax_query = array(
array(
'taxonomy' => 'period',
'field' => 'slug',
'terms' => 'current',
),
);
$query->set( 'tax_query', $tax_query );
}
}
add_action('pre_get_posts', 'filter_movies', 9999);
Related Posts:
- Saving Taxonomy Terms
- Filtering a custom post type by custom taxonomy in archive template
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- get term archive url / link
- Pagination throws 404 error on custom taxonomy archive pages
- How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?
- Filter for “get_post_type_archive_link()”
- Archive page with multiple taxonomies rewrite
- Create permalink structure for one taxonomy archive per custom post type
- Filter get_categories() for taxonomy term in WordPress
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- Multiple post types in archives (filter?)
- Pages, Custom Posts & Custom Taxonomy defining slug structure
- How to show a tag archive of one post type only
- Custom taxonomy archive page not working
- Highlight nav menu terms
- How to show multiple post types on taxonomy archive?
- Disable single pages and archives and keep preview
- Help with issues on “Adding a Taxonomy Filter to Admin List for a Custom Post Type?”
- Want to filter only parent post in admin area
- How to create archive page for taxonomy terms within custom post type
- What is better: Custom Fields vs Custom Taxonomies with Terms for perfomance, scalability and better user experience
- Category and post tag archives do not include posts from custom post type
- Custom Taxonomy breaking pages permalinks
- Get post type from taxonomy or category page
- Filter custom post type archive page with custom taxonomies (categories) with AJAX
- custom taxonomy archive by year
- Display custom post type taxonomies as an archive page
- Archive page for taxonomy terms
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Custom Post Type Archive Page Filtering
- Root slug of taxonomy returning 404
- Genesis filterable portfolio isotope [closed]
- How can I see a list of my Custom Post Types of the last term I was in?
- Filtering WP_Query
- Displaying custom taxonomy in the admin list of a custom post type
- Create template for taxonomy results limited by Custom Post Type
- Categories of custom taxonomy don’t show any posts
- WordPress sort search results by custom order
- How to filter wp_list_categories output with some custom post type meta query?
- How to Filter custom post type by taxonomy?
- Filter term taxonomy metabox in custom post type
- How can I made custom taxonomies relationship?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- Sort and filter custom post type posts by custom taxonomy
- Custom post type / taxonomy rewrite archive page 2 gives 404
- How can I get this request to use the Custom Post Type page template instead?
- Archive for a Taxonomy of a Custom Post type
- What’s the name of the custom post type yearly archive template?
- Custom Post type & Taxonomy 404
- Taxonomy archive 404ing (not term archive)
- Filter posts by tax (dropdown) and meta value
- Custom taxonomy or custom page templates?
- Dynamically insert an article at the top of a taxonomy archive – or?
- How do I add custom HTML to the content of an archive page’s posts?
- REST filters only firing when I have a param set
- Use the custom post type archive for taxonomies?
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- Get the link of the first post of a custom taxonomy in a custom taxonomy list
- Archive page for custom post type and custom taxonomy
- Custom Taxonomy Filter Issues
- Advanced archive url structure (category, tag and date)
- How can I tell if I’m on a custom post type archive page?
- Is possible register two archive pages for single custom post type?
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Custom Post Type Archive Page showing as 404
- Store a value in global scope after init hook is fired
- Filter in Custom post type to find the parent post
- Set up Custom Taxonomy Archive Template File To Cover 3 Categories
- How to show custom post count in archive page
- Order archive custom posts by taxonomy term [duplicate]
- Insert custom taxonomy into category query
- Custom category taxonomy – archive page not showing up
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Custom taxonomy archive slug overwrites static page
- Creating adminable dynamic filtering on custom post type
- Custom Post Type tag taxonomy “Page Not Found”
- Dropdown switching subcategories portfolio
- archive-{custom_post_type}.php not getting recognized wordpress
- Archive.php is not displaying tags
- Exclude Custom Post Type from shared Custom Taxonomy
- How to display custom post types AND regular posts separately on a shared taxonomy archive?
- Taxonomy Query of Custom Post Displays Archive Instead of Posts
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- Show custom category archive as front page and remove taxonomy slug from urls
- Add Custom Taxonomy Terms as CSS Classes for CPT Posts in an Elementor Loop Item Template
- Multiple Paginations on one Page
- Custom Post Type permalink shows wrong page: homepage/index.php
- Hierarchial Custom Post Types/Taxonomies
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- Query Custom Post by taxonomy multiple categories
- show most viewed posts of last days by link?
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- Custom taxonomy terms as children of multiple custom post types
- pricefilter without WooCommerce
- Getting (Invalid) when adding custom taxonomy of custom post type link in menu [closed]
- Display custom taxonomy posts of custom post types
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- Limit taxonomy terms added to a custom post type