Skip Navigation

[Resolved] Random records showing up when restricting by a taxonomy

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by saint 3 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#1901493

Tell us what you are trying to do?

Hi there, I am trying to create a View which displays records of the same CPT by constraining them with a taxonomy. In my initial test, it appeared to be working, but later on I began to get wonky results such as records that are not chosen in the taxonomy show up, or even records that are of a different CPT.

In the view are two main criterion:

1.) A taxonomy filter
2.) A many-to-many relationship between 2 CPTs

Please see hidden link for a walkthrough of the issue.

Login: hidden link
Link to View: hidden link
Link to CPT admin area: hidden link

Example CPT with the Issue: hidden link
Example CPT linked to the Issue: hidden link

Please let me know if you have any questions. Thank you!

#1901913

Hi,

Thank you for contacting us and I'd be happy to assist.

In your video, you mention that you'd like to show the results from the same CPT, but in the view's "Content Selection", two CPTs "Software" and "Alternatives" are selected.

Based on the current settings in the view with the taxonomy filter, this is the logic that it uses:
"Get all posts from Software and Alternatives CPTs, where the Software alternatives taxonomy terms are the same as the page where this view is shown"

This means that if the view is being shown on a single software post "Basecamp" ( /software/basecamp/ ), that post has two Software alternatives taxonomy terms "Jira" and "Trello". The view uses these two terms as reference for the taxonomy filter and gets all the posts in two CPTs "Software" and "Alternatives", which have any of these terms attached.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1910237

Hi Waqar,

Thank you for your response! I have 2 follow-ups:

1.) In the video, I have two records tied together by common Taxonomy terms in the backend, but on the frontend, I still do not see it.

I reseted my taxonomy terms a few days ago to 0 for every record, then slowly re-added them in. At first it was working fine, but as you can see in this video, they're no longer showing up again.

hidden link - Beginning to ~1:20m

2.) For the Toolset View to display images, I am seeing a behavior where the same View will display some images for a record, but no images for other records -- despite the fact that there are images in all of the test records, and also it's the same View in the template.

In my debugging, I am not seeing why there is a discrepancy - this is the same View across records because it is inserted into a Template.

hidden link - Starts ~1:20m

#1912035

Thanks for writing back.

1.) In the view "Loop ⟩ List of Software constrained by Software Alternatives tax" skip first 1 item option was selected.
( screenshot: hidden link )

Based on common "Software alternatives" terms, there was only one other software post "Basecamp" that would qualify as an alternative for the software post "MeisterTask Project Management Software", but that was being filtered out, because of that offset to 1 option.

I've changed that skip option to "None" and the view is now showing the "Basecamp" post correctly, as an alternative.

Note: You should also de-select "Alternatives" post type from this view's content selection, since the "Software alternatives" taxonomy is only associated with the "Software" post type. Because of that taxonomy filter, this view can't show any posts from "Alternatives" post type.

2.) As for the view "Loop ⟩ List of Software Images in Software CPT", I see it is using the post relationship query filter to get the information from the same current post, which is not the correct way. This relationship filter should be used only for the cases when we need to get the information from the related posts from the other post types.

If your goal is only to get the current software post's images from the "software-imgs" custom field, you can remove that view from your template and call the image field's shortcode directly:


[types field='software-imgs' title='%%TITLE%%' alt='%%ALT%%' align='left' size='medium' resize='crop' separator=', '][/types]

If you'd prefer to show these images through this view, you can remove the post relationship filter from the query filter and instead add a post ID filter, linked to shortcode attribute "ids".
( example screenshot: hidden link )

And then in your template, you'll call this view using "wpv-view" shortcode and passing current post's ID through the "wpv-post-id" shortcode:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/ )


[wpv-view name="loop-list-of-software-images-in-software-cpt" ids="[wpv-post-id]"]

#1918623

My issue is resolved now. Thank you!