Closed chafields closed 4 years ago
Issue-Label Bot is automatically applying the label Type: Bug
to this issue, with a confidence of 0.64. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Ok, found the WHERE clause problem. The leading leading double-quote was not a plain quote but a special quote. Replaced it with a plain one and experimented a bit more. The working shortcode is: [pods name=qpm_form template = NewEntry where="category.slug ='risk-form'"] No need for a link to category, so removed it.
Describe the bug
I have read 2 articles that describe ways to filter posts by category (std taxonomy), but when I try them, neither filters any posts!
Method1: https://wordpress.org/support/topic/pods-shortcode-how-to-filter-by-category-of-built-in-taxonomies/#post-12997553 This seems the easiest, does not involve use of magic tags, and has a WHERE clause example. One problem I see in reading it is that a post could have multiple categories and the code does not show any selection method among catgories. My own posts have one category each, so perhaps that is not an issue.
The Issue is that it doesn't work. All posts are displayed.
Method2: https://docs.pods.io/displaying-pods/magic-tags/using-magic-tags/#Taxonomies Here I am on more familiar ground, having implemented a link to Users on another page. So I added to the qpm_form pod a link to category, calling it pods_category, with the intent that it is the Key category, singular, even if multiple categories are selected at the post. In this field, just one is selected. With the link added, I updated each post (three at this point) pods_category link and update the shortcode to: [pods name=qpm_form template = NewEntry where=“'{@pods_category.slug}'='risk-form'"] The categories already had slugs, so the slug name is unchanged from Method1. Again, no filtering is observed. url ..my-forms/?pods_debug_sql=1 to see the SQL, which has no mention of category or any other part of the WHERE above. This method is "brute force" compared to method1 but let's focus on getting method2 to work, please.
To Reproduce Steps to reproduce the behavior: pm me for credentials or just signup as a Contributor This membership level should have access to just one form, 'risk-form'
Expected behavior A clear and concise description of what you expected to happen. Should be just One Button on the page.
Screenshots
Pods Version
Pods - Custom Content Types and Fields: 2.7.21
WordPress Environment
Pods Package Export (helpful!)