php WP迁移DB Pro迁移后清除Elementor缓存 - 必须使用插件(mu-plugins)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php WP迁移DB Pro迁移后清除Elementor缓存 - 必须使用插件(mu-plugins)相关的知识,希望对你有一定的参考价值。

<?php
/*
Plugin Name: FD Clear Elementor Cache After WP Migrate DB Migration
Plugin URI: https://gist.github.com/heyfletch/769c64ad1fab8679032b076433afafd1
Description: Deletes CSS in uploads/elementor/css, which auto-regenerates on pageload. This clears the cache locally and remotely. Must-use plugin (mu-plugin).
Author: Fletcher Digital
Version: 0.1.1
Author URI: https://fletcherdigital.com
*/

// Whitelist Elementor to load during a migration (avoids Migrate DB Pro's Compatibility mode)
add_filter( 'wpmdb_compatibility_plugin_whitelist', function ( $plugins ) {
	$plugins[] = 'elementor';
	return $plugins;
} );


add_action( 'wpmdb_migration_complete', 'fd_clear_elementor_cache' );
function fd_clear_elementor_cache() {

	// Check if Elementor installed and activated
	if ( did_action( 'elementor/loaded' ) ) {

		// clear Elementor cache
		\Elementor\Plugin::instance()->files_manager->clear_cache();
	}
}

以上是关于php WP迁移DB Pro迁移后清除Elementor缓存 - 必须使用插件(mu-plugins)的主要内容,如果未能解决你的问题,请参考以下文章

php FD-WP-迁移-DB-PRO-tweaks.php

php FD-WP-迁移-DB-PRO-tweaks.php

php 允许从实时拉出(WP Migrate DB Pro)而不在本地激活不需要的插件

php 允许从实时拉出(WP Migrate DB Pro)而不在本地激活不需要的插件

解决 WP迁移后出现的404错误

Wordpress 数据库和 WP 迁移