Files
yeuchaybo/lib/functions/upgrade.php
T
Thuan Bui fd25f13a4f Initial
2018-06-26 11:09:22 +07:00

54 lines
1.3 KiB
PHP

<?php
/**
* Child Theme Library
*
* WARNING: This file is a part of the core Child Theme Library.
* DO NOT edit this file under any circumstances. Please use
* the functions.php file to make any theme modifications.
*
* @package SEOThemes\ChildThemeLibrary\Functions
* @link https://github.com/seothemes/child-theme-library
* @author Thuan Bui
* @copyright Copyright © 2018 Thuan Bui
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
die;
}
add_filter( 'http_request_args', 'child_theme_dont_update_theme', 5, 2 );
/**
* Don't Update Theme.
*
* If there is a theme in the repo with the same name,
* this prevents WP from prompting an update.
*
* @since 1.0.0
*
* @param array $request Request arguments.
* @param string $url Request url.
*
* @return array request arguments
*/
function child_theme_dont_update_theme( $request, $url ) {
// Not a theme update request. Bail immediately.
if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) ) {
return $request;
}
$themes = unserialize( $request['body']['themes'] );
unset( $themes[ get_option( 'template' ) ] );
unset( $themes[ get_option( 'stylesheet' ) ] );
$request['body']['themes'] = serialize( $themes );
return $request;
}