The taxonomy template you have (taxonomy-insight_type-academia.php
) is in the form of (taxonomy-{taxonomy}-{term}.php
), and the format for is_tax()
is is_tax( '<taxonomy>', '<term>' )
, so in your pre_get_posts
callback, you should:
// Use this.
if ( $query->is_tax( 'insight_type', 'academia' ) )
// Not this.
if ( $query->is_tax( 'academia', 'insight_type' ) )
Additionally — to avoid conflict with other queries, you should also check if the current query is the main one or not, and also check if it’s an admin-side request.
if ( ! is_admin() && $query->is_main_query()
&& $query->is_tax( 'insight_type', 'academia' )
)
You may already know that, but I thought it’d be a good reminder. 🙂
Related Posts:
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- How are terms connected with posts in database?
- Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms
- get_terms parent for current product only
- deleting terms programmatically
- Adding Multiple Values to a Post Meta Key
- Avoid duplicate post from same Taxonomy
- Set terms in a custom post
- Get posts of ONE taxonomy term of custom post type
- Force the “Choose from the most used tags” meta box section to always be expanded
- Send post id through ajax and get the post content back
- How to display posts via custom taxonomy terms using checkboxes?
- Loop parent terms {display posts} AND loop child terms {display posts}
- Custom post type and taxonomy page templates
- Post not using taxonomy template
- How to Display Most View Post in the template file?
- Displaying Results From Custom Taxonomy Query
- How to get all the terms of a post
- How to display the link (title) and thumbnail post?
- How to bulk-untag multiple posts?
- Show the content that is after the excerpt using child theme
- How to allow users to post only in certain category and hide elements from edit page?
- Posts list in custom taxonomy
- How to do set post permalinks using 6 digit random unique function?
- Can’t get buddypress notifications in front-end; why do I get this error?
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- Switch to page template when using post permalink
- How do I display some posts fully on the homepage, and some as an excerpt only?
- Get Posts Under Custom Taxonomy
- Genesis + Ajax + Jquery | Failling to call action
- Prepending %category% onto default posts fails
- get_adjacent_post by language
- Get Page ID of blog homepage
- Duplicate Custom Post Type and Taxonomy Slug
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- How can I setup a relationship using categories in WordPress?
- custom post template file not shown, instead all the time 404.php
- Display post x of y within category
- Force authors to Preview a post before publishing
- WordPress Automatic Filename Changer
- sql select for post_title and a term name
- How can I hide tags on a child-category page, if that tag has not been used?
- 404 error on default post type and default taxonomy fronted page
- How to create new post content templates for my users?
- Redirect to another page using contact form 7? [closed]
- Order posts alphabetically: how to set order=asc in mysql query?
- How to create a template for Pages?
- How do I stop the loop from repeating in my category template?
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- posts not showing on index.php
- outputting posts’ taxonomies: cant get ‘get_the_taxonomies’ working
- Taxonomy term page going to 404
- Change all author links in Blog roll
- Copy taxonomy terms from one post to another programmatically
- disable Tab post on nav-menus page (Admin)
- Adding bootstrap classes to video shortcodes
- Hide a specific post from a page template
- Every second post different class in blog view
- Format latest/newest post differently
- is_page Funtion for Posts ?
- Tell WP to use a specific template file in posts
- Post type no single page
- relating business and products with custom taxonomy?
- How to make different custom post layouts?
- Is there a query string for edit.php to show all posts that have no custom taxonomy terms?
- Get post meta retrieving wrong value
- Adding a user’s ID behind the tag ref link address
- Isotope Drop Down Categories Filter Function
- The_excerpt() doesn’t parse – how to change that?
- How to only publish posts with image in it
- Why won’t pagination work?
- Isn’t the way posts are displayed very unefficient?
- Is it possible to give the user the chance to select between two single template files to use in a post?
- WordPress bulk category select when publishing post
- Create a custom posts page
- Get Comma Seperated Taxonomy Linked Terms and Last Child Separated By “&” Instead Of Comma
- Add custom text automatically on each post
- how to set social icons to product / post template (Auros theme)? [closed]
- How to identify and hide/remove an element from a WordPress page [closed]
- wordpress posts template remove default template from menu
- How to check in functions.php if there is data in a WP_Query?
- Hierarchical taxonomy list with modificated term links
- Force a specific template as default
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- restrict incrementation of post vies count when refreshing the page
- Parent category / child category posts
- Defined function isn’t showed on page
- wp_set_object_terms NOT working on CPT, but wp_set_post_terms does
- WordPress 302 Redirect to Random Product/Post/Page
- showing posts of an specific category in admin custom menu with style of admin posts section
- Only allow posts with a specific term to only be viewed by other authors with the same term in their post
- Getting Whitescreen when publishing a post [closed]
- Using system date format
- Count the number of a post types associated with another post type
- Get post by tag
- Add code to a specific post’s content
- Related Posts function not working
- Give posts a particular template based on the assigned category
- the_content() Not Grabbing All Content
- Un-highlight Blog Menu Item when Category Menu Item is Selected