Possible to merge these two functions?

Unless I’m missing something, I would think you could just use an OR (||) operator to check if it is_tag() or is_tax(): add_action( ‘pre_get_posts’, ‘sort_conference_by_date’ ); function sort_conference_by_date( $query ) { if ( $query->is_main_query() && !is_admin() ) { if ( $query->is_tag() || $query->is_tax() ) { $query->set(‘orderby’, ‘meta_value’); $query->set(‘meta_key’, ‘start_date’); $query->set(‘order’, ‘DESC’); } } }

Use the custom post type archive for taxonomies?

You can create taxonomy-cat-cpt.php, and inside it just use: <?php get_template_part( ‘archive-cpt’ ); ?> Then they’ll both use the same template. Then inside archive-cpt.php, if you use the_archive_title() archive the_archive_description() it will display the appropriate title and description automatically based on whether you’re viewing the taxonomy or post type archive. Regarding posts, as long as … Read more

Expired event redirect to parent category

Since I have less reputation I can’t comment, this is not answered with code but wanted to help, you may check this plugin: https://wordpress.org/plugins/redirect-404-error-page-to-homepage-or-custom-page/ or just take required code from the plugin ( I am not connected with that plugin anyway )

Remove categories taxonomy from custom post type

First, I believe that “Categories” is actually for the custom taxonomy resource and not the standard category taxonomy. But in the menu, it’s labeled Categories because you didn’t set a custom label for the resource taxonomy (because the label is commented out and defaults to Categories): register_taxonomy( ‘resource’, // the name of the taxonomy ‘resources’, … Read more

Pagination hitting 404 page on /page/4

Just in case anyone ever stumbles across this, I found the solution. First step was to create an archive.php page In there I would access the loop. The in functions.php I have a category rewrite filter to update the category rewrite rules to use the following example url index.php?wpdmcategory=category-name&paged=2 when I hit /category-name/page/2 Previously, it … Read more

Display name of taxonomy once

Not the best, but works well for me: (you can use this instead of what’s in the question) $postcount = 0; //global $wp_query; // Uncomment if necessary. // Group the posts by category. $groups = []; foreach ( $wp_query->posts as $i => $p ) { $terms = wp_get_post_terms( $p->ID, ‘show_category’ ); foreach ( $terms as … Read more