Skip Navigation

[Resolved] Importing posts

This support ticket is created 4 years 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 1 reply, has 2 voices.

Last updated by Waqar 4 years ago.

Assisted by: Waqar.

Author
Posts
#1836769

Hi

I am using a plugin to import posts but it doesn't set a field that is a tick box.

As its not configured to update this, Toolset doesn't seem to store the unchecked value until I go in and edit the post, which I wont do often.

I want to filter by this field to exclude ones which are CHECKED. However when I create a filter to exclude ones where the value is 1, nothing shows up because its as no value at all. I would think if it has no value therefore it isn't equal to 1.

Any ideas?

Thanks

#1838413
checkboxe-type-field.png

Hi,

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

The way custom field query works in WordPress, it only considers those posts which have at least one custom field record attached with the target custom field's key.

This means that if you're filtering by a custom field for example "field-a", only those posts would be considered which have:

- some value stored with the key "field-a"
- 0 saved as a value with the key "field-a"
- empty or no value is saved with the key "field-a" (but a custom field record exists with this key)

In other words, any post where there is no custom field key record for the "field-a", it will be ignored.

This where the "When unchecked, save 0 to the database" option in the checkbox type custom field's settings, comes in handy.
( example screenshot attached )

Please note how I've set the field to save 1 when the checkbox is checked and 0 when it isn't checked.

Similarly, if you're importing the posts, you'll need to make sure to save 0 for this field, for the unchecked state.

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

regards,
Waqar