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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+01:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Bruno Kos 1 year ago.

Assisted by: Bruno Kos.

Author Posts
October 20, 2023 at 3:06 pm #14625129

evgenyM

I would like to add a custom column that displays the word count for each translation job/task in the table. This would help our translators gauge the size of each task at a glance.

I've tried to find hooks or filters in the WPML documentation that would allow me to add this custom column, but I haven't had any luck so far. Could you guide me on how to achieve this? Is there a specific hook or method within WPML that I can use to add a custom column to the Translation Management table?

Additionally, I would like this custom column to calculate and display the word count for the original content that needs to be translated. Any guidance on this would be greatly appreciated.

Снимок экрана 2023-10-20 170522.png
October 23, 2023 at 9:56 am #14635751

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Thank you for contacting WPML support!

I'm afraid there isn't a way to achieve this nor officially supported hook. I was able to trace this down to wpml_tm_dashboard_word_count_estimation action within classes\words-count\hooks\wpml-tm-word-count-admin-hooks.php.

Perhaps you can try using this function like this:

function custom_wpml_word_count_estimation($word_count, $post_id, $lang_code) {
    // Your custom word count estimation logic goes here
    // $word_count is the default word count calculated by WPML
    // $post_id is the post ID for which the word count is being estimated
    // $lang_code is the language code for the target language

    return $custom_word_count;
}

add_action('wpml_tm_dashboard_word_count_estimation', 'custom_wpml_word_count_estimation', 10, 3);

But then you would still need to somehow hook it into the location you are after. I'm afraid not this is officially supported or documented, you can perhaps check with our https://wpml.org/contractors/ to have this solution custom coded.

Regards,
Bruno Kos

October 23, 2023 at 10:30 am #14636627

evgenyM

that is, there is no hook in the plugin to add a custom column to this table?

Screenshot (15).png
October 23, 2023 at 11:27 am #14637677

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

That's right.

You can check all available hooks here:
https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/#hook-991570

The topic ‘[Closed] Adding a Custom Column to the Translation Management Table’ is closed to new replies.