Link to a page where the issue can be seen: hidden link
Note: I have now fixed the bug by modifying the plugin (see below) so the bug is currently not visible on the page, but you can see it on the attached screenshot.
I expected to see:
All the taxonomy terms listed in the filter (see attached screenshot)
Instead, I got:
Only the term of the current (queried term) taxonomy archive. See attached screenshot.
Following the fix to be applied on file wp-views/embedded/inc/walkers/wpv_walker_taxonomy_select.class.php around line 127.
Original code:
// If the current page is a taxonomy page for the taxonomy the filter refers to
if ( $this->in_this_tax_archive_page ) {
// ... and if the queried taxonomy term is the current term rendered in the filter
if ( $this->tax_archive_term->slug == $taxonomy_term->slug ) {
// ... display the term and make it selected
if ( $this->walker_args['counters'] ) {
$wpv_tax_criteria_matching_posts = array();
$wpv_tax_criteria_to_filter = array( $taxonomy_term->term_id => $taxonomy_term->term_id );
$wpv_tax_criteria_matching_posts = wp_list_filter( $this->walker_args['query_cache'], $wpv_tax_criteria_to_filter );
$taxonomy_term->tax_option = str_replace( '%%COUNT%%', count( $wpv_tax_criteria_matching_posts ), $taxonomy_term->tax_option );
}
$output .= '<option value="' . $tax_value . '" selected="selected">' . $indent . $taxonomy_term->tax_option . "</option>\n";
}
// ... else disregard this taxonomy term option for the filter
} else {
Fixed code:
// If the current page is a taxonomy page for the taxonomy the filter refers to
// ... and if the queried taxonomy term is the current term rendered in the filter
if ( $this->in_this_tax_archive_page && $this->tax_archive_term->slug == $taxonomy_term->slug ) {
// ... display the term and make it selected
if ( $this->walker_args['counters'] ) {
$wpv_tax_criteria_matching_posts = array();
$wpv_tax_criteria_to_filter = array( $taxonomy_term->term_id => $taxonomy_term->term_id );
$wpv_tax_criteria_matching_posts = wp_list_filter( $this->walker_args['query_cache'], $wpv_tax_criteria_to_filter );
$taxonomy_term->tax_option = str_replace( '%%COUNT%%', count( $wpv_tax_criteria_matching_posts ), $taxonomy_term->tax_option );
}
$output .= '<option value="' . $tax_value . '" selected="selected">' . $indent . $taxonomy_term->tax_option . "</option>\n";
// ... else disregard this taxonomy term option for the filter
} else {
Hello. Thank you for contacting the Toolset support.
Well - As I understand, you have taxonomy archive for custom taxonomy XYZ and you want to filter same taxonomy archive with the terms of XYZ taxonnomy - correct? If Yes:
This is not possible as you can display only posts belongs to the current term which you are displaying.
For example, post A belongs to term 1, post B belongs to term 2, and you are on archive page that displays the term 1.
you can not display Post B in the archive page of term 1. so we can not filter taxonomy archive with same taxonomy.
you can't filter a taxonomy archive by the same taxonomy. WordPress Archives are not designed to work for a single term within a taxonomy.
If this is not the case, please let me know, I would like to debug this further.
Hi Minesh,
unfortunately, you did not understand correctly the request. I am talking about the available choices in the drop-down taxonomy filter, not about the posts displayed in the page.
That filter is displayed sitewide and it should always have all the available options so that a user can perform any search from any page (including taxonomy archive pages). Of course when a search is performed the results will be displayed on a different page. Unfortunately, the filter doesn't behave correctly on taxonomy pages.
Please check the attached screenshots, I believe they're pretty clear.
There's a bug in the code and I have a posted a fix. Please forward it to your dev team.
Thank you.
Well - I understand. I need to check first on your install how you setup the archive. Then I will consult our Devs with all information.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Well - I consult our Devs and they confirmed that its not a bug. Simply, you should not filter taxonomy archive which belongs to same taxonomy term. It's basically not supported.
I do not know if you know that you can build archives using custom search but only for post type archives. If you will have a taxonomy archive and you will try to filter the taxonomy archive with same taxonomy - you will see the following notice - please check screenshot:
=> hidden link
Unfortunately, it seems you still haven't understood the real problem here, so I will try to explain it from a different perspective. Please forget temporarily all that we have discussed until now and imagine the following scenario:
I want a custom search widget that allows the visitor to search (custom) posts by category/taxonomy. The search widget is included in a widget area that is displayed on EVERY page of the website. Of course, the custom search view and the widget are built according to the documentation that you also linked in your last message.
In this scenario, the search form in the widget is INCORRECT when it's displayed in the taxonomy term archive pages, as it doesn't show all the available categories in the form. Please note that I am talking about the form, NOT about the displayed posts! That way the user cannot perform some searches from those pages. This is definitely a bug in my opinion.
I have also recorded a short video that explains in detail the issue, reproduced in a vanilla WordPress install: hidden link
If you still think this is not a bug (which would be absurd in my opinion), I would really appreciate it if you could provide a filter to disable this odd behavior programmatically, so that I can fix it without being forced to hack the source code of the Views plugin.
Minesh isn't available, I will take care of this thread.
I assume we are talking about the view "Ricerca annuncio": hidden link
in section "Custom Search Settings", you are using option "Always show all values for inputs", so it should be able to output all the taxonomy terms listed in the filter. if it can not, then it should be a bug.
please provide a database dump file (ZIP file) of your website in below "private detail box", I need to duplicate same problem and debug it in my localhost, thanks.
Hi Luo Yang,
thanks for the update. Looking forward to getting the next fixed version.
Please, could you update this thread when the bugfix will be released?
Do you have any ETA?
Thank you.
There isn't any ETA, but since it is a bug, it will be fixed soon, maybe next version of Views plugin, as I mentioned above, I will update this thread if there is anything news.
It is still in our to-do list in "Submitted" state, here is the comment from our developers:
we do not support filtering the the object defining the current archive. This means that on a taxonomy archive the filters by terms in that taxonomy are not applied.
So currently, I suggest don't use the same taxonomy filters in the taxonomy archive page.
Hi Luo Yang,
thanks for your reply. Please note that on July 18th you wrote: "since it is a bug, it will be fixed soon". In the meantime, 1.5 months are passed and no updates on this.
Please also note that I have provided a bugfix for this issue (see the first message), so it would be just a matter of changing a couple of lines of code.
As I have already explained throughout the discussion on the thread, the problem is related to a search filter that is displayed sitewide, so there's not an easy way to avoid using on specific pages (like taxonomy archives), and by the way, it wouldn't be the desired result.
In other words, the suggestion included in your latest reply is not applicable.