Hey guys, I have a number of taxonomy terms that I would like to filter out of the results IF a custom field value is present.
I have a custom post that is 'published' therefore making the taxonomy term publicly visible, however, I have a custom field called "private published" where only users with a code can view the post.
I would like to exclude taxonomy terms being visible that meet the custom field value of '1'
this excludes a fixed list, but how would I check for the presence of a value on the Articles CPT and then grab the items and exclude it from what's returned in the taxonomy loop.
taxonomy: article-tag
Custom field on the "Articles" cpt to check against: wpcf-private-listed = 1
IF wpcf-private-listed = 1 dont show taxonomy terms in view output.
Hello. Thank you for contacting the Toolset support.
As I understand, you created a post type that holds the checkboxes fields where user can select those checkboxes to make the terms should be excluded.
So, for example: You have post type "Students": with taxonomy having terms 1 to 5.
- Post 1 (term 1, term 2 selected)
- Post 2 (term 2 selected)
- Post 3 (term 1 selected)
- Post 4 (term 2 selected)
- Post 5 (term 2 selected)
So, with all above 5 posts for student post type, term 1 and term 2 selected, so you want that term 1 and term 2 posts should not be displayed with the view? Only posts belongs to term 3, term 4 and term 5 should be displayed as those terms are not selected within the available posts?
The example you have provided is not quite what I had in mind... I'll expalin further
I have a post that is 'published', however the post is not public - its restricted from being viewed unless someone enters a specific code in a URL parameter.
I also have a view that filteres out all private public posts using a custom checkbox field on each of them 'private post' so they are not searchable.
However, if the 'private published' post has a taxonomy term that is not used by any other public posts then that taxonomy term is visible.
Now this isnt a major issue, but it would be good if I could apply the same logic I do to the main View, on the Taxonomy terms view.
If you can share problem URL and access details and setup a test example and tell me at what point what posts/taxonomy should be visible, so once I can review your current setup I will be in better situation that will help me to guide you in the right direction.
Please share all required information with test example.
*** 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 have set the next reply to private which means only you and I have access to it.
The topic ‘[Closed] filter taxonomy based on custom field value and exclude if ticked’ is closed to new replies.