Setting posts_per_page for taxonomy term template

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 … Read more

$_FILES empty on created_{taxonomy} and create_{taxonomy} yet is is not on edit_{taxonomy}

This is just a half answer, but I wanted to share my findings. When adding a new term via the Add Term screen /wp-admin/edit-tags.php?taxonomy=work_type&post_type=work, AJAX is being used and it is not handling the $_FILES array, so it is empty. If you disable JS in your browser temporarily, then reload the page, add a new … Read more

How to Filter custom post type by taxonomy?

I believe you can add the following to the theme’s functions.php & visit /courses/?topics=foo,bar to get the results you’re looking for: <?php /** * Custom search-query with taxonomy filter */ function wpse373353_search_query( $wp_query ) { // exit early if this isn’t that main loop on the front-end of the site if ( ! $wp_query->is_main_query() || … Read more

Get authors by term id or slug

Create a custom post type for authors associated with a specific tag and provide a field for author ID. Iterate over your array of authors and for each one create a new “tag author”. Finally, create a WP_Query for this post type to generate a paginated output of data associated with the author ID.

how to show only last child terms of a taxonomy

I wanted to display the terms with the get_the_term_list function so, since categories & taxonomy have a “similar logic”, I replaced the “the_category_list” add_filter( ‘the_category_list’, ‘ci_theme_the_category_list_remove_parent_categories’, 10 ); with “get_the_terms” add_filter( ‘get_the_terms’, ‘only_last_taxonomy_terms’, 10 ); and it does what I need.