Skip Navigation

[Resolved] Error message doesn't make sense

This support ticket is created 4 years, 12 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 2 replies, has 2 voices.

Last updated by duongN-3 4 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#1395081
Screen Shot 2019-11-28 at 9.53.00 PM.png

I am trying to:
Update an error message in front-end forms when adding a relationship "person" post type to a "movie" post type.

Link to a page where the issue can be seen:
hidden link

I expected to see:
This doesn't make sense in English. It should read something like "This person doesn't exist. Please add" or something along those lines.

Instead, I got:
When you search for a person in the dropdown and that person doesn't exist, the dropdown says, "No person can be associated to Hana Yori Dango Final (movie type)"

#1396051

Hi,

Thank you for waiting.

During troubleshooting, I noticed that the no-match found message is added in a localization/translation friendly way.

This means that it can be customized using the "gettext" filter:
https://developer.wordpress.org/reference/hooks/gettext/

Example:


add_filter( 'gettext', 'customize_no_match_found_label', 20, 3 );
function customize_no_match_found_label( $translated_text, $text, $domain ) {
	if($translated_text == 'No %POST_TYPE_LABEL% can be associated to %OTHER_POST_TITLE%') {
		// assign a different message
		$translated_text = 'No %POST_TYPE_LABEL% found with this title, which can be associated to %OTHER_POST_TITLE%';
	}
	return $translated_text;
}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.

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

regards,
Waqar

#1397015

My issue is resolved now. Thank you!