Get 404 when using url parameters to filter custom post type archive page created with wp bakery post grid
Get 404 when using url parameters to filter custom post type archive page created with wp bakery post grid
Get 404 when using url parameters to filter custom post type archive page created with wp bakery post grid
Search Filter by mime type not working in pre_get_posts
You are right to say: Never use query_posts anymore pre_get_posts pre_get_posts is a filter, for altering any query. It is most often used to alter only the ‘main query’: add_action(‘pre_get_posts’,’wpse50761_alter_query’); function wpse50761_alter_query($query){ if( $query->is_main_query() ){ //Do something to main query } } (I would also check that is_admin() returns false – though this may be … Read more
pre get posts not working with Tribe Events
Include posts under a custom taxonomy in author.php
Admin products page column not sorting
Use this- function custom_tag_archive_query( $query ) { if ( is_tag() && $query->is_main_query() && !is_admin() ) { $tag = get_queried_object(); $tag_name = $tag->name; $similar_names = get_term_meta( $tag->term_id, ‘similar_names’, true ); $similar_names_array = explode( ‘,’, $similar_names ); $similar_names_array = array_map( ‘trim’, $similar_names_array ); $similar_names_array[] = $tag_name; // include the tag name itself in the search terms $meta_query … Read more
Search for meta_query does not return any result if combined with title
Figured it out, it was simpler than I expected. /** * Include catalog posts in archives, even though they’re not “public” * * @param WP_Query $query * @return WP_Query */ function wpse415668_catalog_posts_in_archives(WP_Query $query): WP_Query { if (! $query->is_admin() && $query->is_main_query() && $query->is_tax(“catalog_category”)) { $query->set(“post_type”, “catalog”); } return $query; } add_filter(“pre_get_posts”, “wpse415668_catalog_posts_in_archives”);
Hide empty categories on widget