Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Bruno 4 years, 1 month ago.

Assigned support staff: Bruno.

Author Posts
July 5, 2017 at 9:15 am #1312374


I am trying to:
How can we use wpml to translate content which is stored in custom tables. We are writing a plugin to manage web-based-promotions. We do not use custom-post-types. How can we get translation going after entering a new promotion and do i have to create extra fields for the translations? ( or are they stored somewhere else?

URL of (my) website where problem appears:

I expected to see:

Instead, I got:

Steps to duplicate the issue:

July 5, 2017 at 12:58 pm #1312607



Thank you for contacting us.

To translate custom content, you'll need to use some WPML hooks.

For example, to save the strings and displayed on the String Translation page, you can use these hooks:

You can see more in our documentation:

Also, you can check other hooks in our documentation:

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

July 28, 2017 at 7:30 am #1329407



thanks so far for the explanation, still some other questions..

I attached a screenshot of our datatype input form ( apologies , it's in Dutch )
The datatype is stored in custom tables, and they are created via the form.( no custom post types, 100% coded )
The problem is that they also need to be displayed in French, because the site is both Dutch and French.
When and how should I register all the content ( strings ) for translation?
After saving the record in the database?
And it seems that all the strings should have a unique id, right?
How can I solve that?

Will the process be the following ?
- create datatype via form
- register strings after saving for translation
- send and receive translations, and they all will be managed as string translations

Thanks for your help.

July 28, 2017 at 1:07 pm #1329711



Yes, the process is going to be basically this. After saving the options in the database, you will need to use the functions I posted above to make these strings translateable (register and retrieve).

Here is a very basic example, without involving database - you can adapt it according to your needs:

// functions.php theme's file - you can use this in plugins as well.
function translate_strings() {
	// String for translation
	$string = "My String";

	// register the string for translation
	do_action( 'wpml_register_single_string', 'my-string context', 'my-string', $string );

	// display original string or translated string
	echo apply_filters( 'wpml_translate_single_string', $string, 'my-string context', 'my-string' );

// display on the front-end
if( ! is_admin() ) {

Then in WPML > String Translation, you can translate the string that will be displayed on the front end. I'll attach an image for you to see.

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.