Home › Toolset Professional Support › [Resolved] Many to Many default no match/no results found message
Problem:
But in my many-to-many relationship forms, it says "No (cpt) can be associated to (post title)". This is confusing to the user. I would rather it say "no results found" like the other forms, or "does not match available selections" or something like that.
Solution:
You can customize that message with WP filter "gettext", for example:
Relevant Documentation:
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/Hong_Kong (GMT+08:00)
This topic contains 4 replies, has 2 voices.
Last updated by sarahK-2 2 years, 7 months ago.
Assisted by: Luo Yang.
I have many:many relationship forms.
In the one:many relationship forms, when a wrongly spelled or non-existent post is typed in it says "no results found".
But in my many:many relationship forms, it says "No (cpt) can be associated to (post title)". This is confusing to the user. I would rather it say "no results found" like the other forms, or "does not match available selections" or something like that.
I can't find where to make this change. Thanks in advance.
Hello,
You can customize that message with WP filter "gettext", for example, add below codes into your theme file "functions.php":
add_filter( 'gettext', function( $translated_text, $untranslated_text, $domain ) { if ( 'wp-cred' == $domain && 'No %POST_TYPE_LABEL% can be associated to %OTHER_POST_TITLE%' == $untranslated_text ) { $translated_text = 'no results found'; } return $translated_text; }, 10, 3 );
More help:
https://developer.wordpress.org/reference/hooks/gettext/
Thanks Luo, this worked great on a test site, but did not work on the actual site. Any ideas about what I might check/troubleshoot?
There might be some cache issue in your website, if you are using some other cache plugins, please try to clear cache and test again.
It was not a cache issue. It was a plugin conflict. Either way, all fixed, and thank you for your help.