Filter hook 'translations_api_result'

in WP Core File wp-admin/includes/translation-install.php at line 141

View Source

translations_api_result

Filter Hook
Description
Filters the Translation Installation API response results. List of translations, each an array of data. } } }

Hook Information

File Location wp-admin/includes/translation-install.php View on GitHub
Hook Type Filter
Line Number 141

Hook Parameters

Type Name Description
array|WP_Error $res { On success an associative array of translations, WP_Error on failure.
string $type The type of translations being requested.
object $args Translation API arguments.

Usage Examples

Basic Usage
<?php
// Hook into translations_api_result
add_filter('translations_api_result', 'my_custom_filter', 10, 3);

function my_custom_filter($res, $type, $args) {
    // Your custom filtering logic here
    return $res;
}

Source Code Context

wp-admin/includes/translation-install.php:141 - How this hook is used in WordPress core
<?php
 136  	 *     }
 137  	 * }
 138  	 * @param string         $type The type of translations being requested.
 139  	 * @param object         $args Translation API arguments.
 140  	 */
 141  	return apply_filters( 'translations_api_result', $res, $type, $args );
 142  }
 143  
 144  /**
 145   * Get available translations from the WordPress.org API.
 146   *

PHP Documentation

<?php
/**
	 * Filters the Translation Installation API response results.
	 *
	 * @since 4.0.0
	 *
	 * @param array|WP_Error $res  {
	 *     On success an associative array of translations, WP_Error on failure.
	 *
	 *     @type array $translations {
	 *         List of translations, each an array of data.
	 *
	 *         @type array ...$0 {
	 *             @type string   $language     Language code.
	 *             @type string   $version      WordPress version.
	 *             @type string   $updated      Date the translation was last updated, in MySQL datetime format.
	 *             @type string   $english_name English name of the language.
	 *             @type string   $native_name  Native name of the language.
	 *             @type string   $package      URL to download the translation package.
	 *             @type string[] $iso          Array of ISO language codes.
	 *             @type array    $strings      Array of translated strings used in the installation process.
	 *         }
	 *     }
	 * }
	 * @param string         $type The type of translations being requested.
	 * @param object         $args Translation API arguments.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-admin/includes/translation-install.php
Related Hooks

Related hooks will be displayed here in future updates.