Filter hook 'translations_api'

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

View Source

translations_api

Filter Hook
Description
Allows a plugin to override the WordPress.org Translation Installation API entirely.

Hook Information

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

Hook Parameters

Type Name Description
false|array $result The result array. Default false.
string $type The type of translations being requested.
object $args Translation API arguments.

Usage Examples

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

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

Source Code Context

wp-admin/includes/translation-install.php:50 - How this hook is used in WordPress core
<?php
  45  	 *
  46  	 * @param false|array $result The result array. Default false.
  47  	 * @param string      $type   The type of translations being requested.
  48  	 * @param object      $args   Translation API arguments.
  49  	 */
  50  	$res = apply_filters( 'translations_api', false, $type, $args );
  51  
  52  	if ( false === $res ) {
  53  		$url      = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
  54  		$http_url = $url;
  55  		$ssl      = wp_http_supports( array( 'ssl' ) );

PHP Documentation

<?php
/**
	 * Allows a plugin to override the WordPress.org Translation Installation API entirely.
	 *
	 * @since 4.0.0
	 *
	 * @param false|array $result The result array. Default false.
	 * @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.