Skip Navigation

[Gelöst] Custom field filter to select only empty fields

This support ticket is created vor 6 Jahre. 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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

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

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by zoeS vor 6 Jahre.

Assigned support staff: Noman.

Author
Artikel
#474507
Screen Shot 2017-01-06 at 12.36.02.png

Hi, I have just added a new custom field, "secret" to my post type, "houses", and in all of my views that display houses, I only want to display the ones that are not secret. I can't seem to figure out how to do this using the query filter options available though, since I suppose the ones I'm trying to identify don't actually have any data for the new field, and everything I have tried returns no results.

I have attached a screenshot of what I tried, but I guess the problem is that there is no string on the non-secret houses, even an empty one? I suppose I could run a query to add 0 to all of them except the secret ones, but is there a way to avoid that?

#474713

Noman
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Zoe,

Thank you for reaching out to us. You can do it either using Query Filters or using Conditional Output conditions in your loop.

I have shown this setup using Query Filter in a short video here, please take a look:
hidden link

Please note since we are adding a new custom field, old posts needs to be simply “Updated” once to respect to the values of the filter in order to display correct results.

I hope this will solve your problem. Have a great weekend.
Thank you

#475068

Thanks Noman, you're right the way I had it set up worked fine after all of the posts had been resaved.