Skip Navigation

[Resolved] Find posts/pages that do NOT contain a search term given by shortcode-attribute?

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the customer wanted to do a text search using our views plugin but instead of searching for texts that were entered the user wanted to do a search and return posts that do NOT contain the items searched for.

Solution:
In this case no its not possible since its a parametric search.

So its not possible to do it like this, only with static filters.

This support ticket is created 6 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 16 replies, has 2 voices.

Last updated by a.R 6 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#604799

a.R

Hi, is that possible?

THANK YOU, regards

Achim

#604872

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

From your post I gather that you want to filter for all the posts that don't have a certain value correct? This value will be specified by the shortcode parameters.

Please let me know.

Thanks,
Shane

#604972

a.R

Hi Shane,

yes, that´s right. Is there a way to do that?

(I was trying to save you some work by not having to read the same thing twice, next time I will be more detailed... 🙂 )

Thank you, regards,

Achim

#605133

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

not in.PNG

Hello,

No worries, take a look at the screenshot and all that is needed is to set the filter to "different from"

Please let me know if this helps.
Thanks,
Shane

#605152

a.R
temp.jpg

Thank you so far.
Now I want to check in the post title and post content and so I get a different form (see picture).
Regards, Achim

#605170

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for the clarity.

In this case no its not possible since its a parametric search.

So its not possible to do it like this, only with static filters.

Please let me know if this helps.

Thanks,
Shane

#605354

a.R

Uuuhh, that´s really a pity...

Is it possible with some php-coding maybe? Could you perhaps give me a hint there?

THANK YOU;

Achim

#605462

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

If this is the only field that will be on your search then you might be able to do it like this with a custom filter.

Take a look at the link below.
https://toolset.com/forums/topic/filtersearch-by-custom-post-type/

The code in the resolved summary allows you to do a search using a custom filter.

Now you will need to adjust this using a standard wordpress query.

The text that you are filtering for, is it in a custom field ?

Please let me know as this will determine what kind of query will need to use.

Thanks,
Shane

#605993

a.R

Ok, I will try that, THANK YOU.
Nevertheless, it would be good to be able to search for more fields in that search...

Regards, Achim

#606437

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Achim,

Happy I was able to assist you with this.

Please let me know if it works out well.
Thanks,
Shane

#607029

a.R

So there is no way to search for more fields in that search?

#607216

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

I'm not sure what is meant by more fields.

Are you referring to using this search area to search through custom fields ?

Please let me know.
Thanks,
Shane

#608162

a.R

Yes, I do.

#608681

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Yes there is. Using the relevanssi plugin it allows you to search through even texts in custom fields.
https://toolset.com/documentation/user-guides/searching-texts-custom-fields-views-relevanssi/

Please let me know if this helps.
Thanks,
Shane

#609110

a.R

I´m sorry, I think I got you wrong.
What I wanna do is search posts by custom search ,
- by taxonomy filter
- that do NOT! contain a certain text in post title and post body.

All these values should be passed to the custom search by shortcode attribute.

Is that possible?

THANK YOU, and sorry again...

Achim