Using WordPress ‘list_translation_updates()’ PHP function

The list_translation_updates() WordPress PHP function displays the update translations form.

Usage

To display the update translations form, simply call the function:

list_translation_updates();

Parameters

This function has no parameters.

More information

See WordPress Developer Resources: list_translation_updates()

Examples

Display Translation Updates in a Custom Admin Page

Create a custom admin page in WordPress to display the update translations form.

// Add custom admin menu item
add_action('admin_menu', 'my_custom_admin_menu');

function my_custom_admin_menu() {
    add_menu_page('Translation Updates', 'Translation Updates', 'manage_options', 'translation-updates', 'display_translation_updates');
}

// Display translation updates form
function display_translation_updates() {
    echo '<div class="wrap">';
    echo '<h1>Translation Updates</h1>';
    list_translation_updates();
    echo '</div>';
}

Check for Available Translation Updates

Use the wp_get_translation_updates() function to check if there are translation updates available and then display the form.

$translation_updates = wp_get_translation_updates();

if (!empty($translation_updates)) {
    list_translation_updates();
} else {
    echo "No translation updates available.";
}

Display Translation Updates on a Custom Dashboard Widget

Create a custom dashboard widget to display translation updates in the WordPress admin dashboard.

// Add custom dashboard widget
add_action('wp_dashboard_setup', 'my_custom_dashboard_widget');

function my_custom_dashboard_widget() {
    wp_add_dashboard_widget('translation_updates_widget', 'Translation Updates', 'display_translation_updates_widget');
}

// Display translation updates in the dashboard widget
function display_translation_updates_widget() {
    list_translation_updates();
}

Create a Shortcode to Display Translation Updates

Create a shortcode to display translation updates in a post or page.

// Register shortcode
add_shortcode('translation_updates', 'shortcode_translation_updates');

function shortcode_translation_updates() {
    ob_start();
    list_translation_updates();
    return ob_get_clean();
}

Display Translation Updates in a Custom Theme Template

Include the translation updates form in a custom theme template.

// In your custom theme template file
echo '<div class="translation-updates">';
list_translation_updates();
echo '</div>';