php 禁用插件或主题的自动更新

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 禁用插件或主题的自动更新相关的知识,希望对你有一定的参考价值。

/**
 * Remove update notification for individual plugins.
 */
if ( ! function_exists( 'pixel_designs_filter_plugin_updates' ) ) {
	function pixel_designs_filter_plugin_updates ( $plugins ) {
		$pluginsToDisable = [
			'advanced-custom-fields/acf.php',
		];
		
		foreach ($pluginsToDisable as $pluginToDisable) {
			if ( empty( $plugins ) || empty( $plugins->response[ $pluginToDisable ] ) ) {
				return $plugins;
			}
			
			unset( $plugins->response[ $pluginToDisable ] );
		}
		
		return $plugins;
	}
	
	add_filter( 'site_transient_update_plugins', 'pixel_designs_filter_plugin_updates' );
}
/**
 * Remove update notification for individual themes.
 */
if ( ! function_exists( 'pixel_designs_filter_theme_updates' ) ) {
	function pixel_designs_filter_theme_updates ( $themes ) {
		$theme = 'invia';
		
		if ( empty( $themes ) || empty( $themes->response[ $theme ] ) ) {
			return $themes;
		}
		
		unset( $themes->response[ $theme ] );
		
		return $themes;
	}
	
	add_filter( 'site_transient_update_themes', 'pixel_designs_filter_theme_updates' );
}

以上是关于php 禁用插件或主题的自动更新的主要内容,如果未能解决你的问题,请参考以下文章

PHP - 覆盖现有函数[重复]

php 禁用WordPress管理面板中的主题和插件编辑器

php 禁用Wordpress插件更新

php 禁用插件更新计数器

php 禁用插件更新

php 禁用WordPress中的自动更新