【WP优化】剔除WP Rocket v3.4.x插件教程部分的方法

博客使用WP Rocket火箭缓存插件也有些时间了,升级3.4版本后,后台手动预加载时总发现比较卡顿,尤其是刷新缓存计数时候。

F12查询了下才发现加载一个国外网站的js,如下:

https://fast.wistia.com/assets/external/E-v1.js        大小604kb

仔细排查发现是插件使用教程视频所调用的,完全没用的东西,跟预加载毫不相关,不知为何还要加载,老外开发的玩意,在墙内还是水土不服啊,还是动手剔除掉这部分吧!操作如下:

1、打开:wp-rocket\views\settings\page.php,删除第49行。

$this->render_tutorials_section();

2、打开:wp-rocket\views\settings\partials\sidebar.php,删除14-17行。

<p><?php esc_html_e( 'Check our tutorial and learn how to measure the speed of your site.', 'rocket' ); ?></p>
	<script src="https://fast.wistia.com/embed/medias/j042jylrre.jsonp" async></script><script src="https://fast.wistia.com/assets/external/E-v1.js" async></script><img src="<?php echo esc_url( WP_ROCKET_ASSETS_IMG_URL . 'play-alt.svg' ); ?>" width="10" height="10" > <span class="wpr-tutorial-link wpr-Sidebar-notice-link wistia_embed wistia_async_j042jylrre popover=true popoverContent=link" style="display:inline;position:relative"><?php esc_html_e( 'Watch the video', 'rocket' ); ?></span>
</div>
<div class="wpr-Sidebar-notice">

3、直接删除:wp-rocket\views\settings\partials\getting-started.php 文件。

4、直接删除:wp-rocket\views\settings\page-sections\tutorials.php 文件。

5、打开:wp-rocket\views\settings\page-sections\dashboard.php,删除194行。

<?php $this->render_part( 'getting-started' ); ?>

6、打开:wp-rocket\inc\classes\subscriber\admin\Settings\class-page-subscriber.php,删除44行,删除153-170行。

[ 'add_tutorials_page', 11 ],
/**
	 * Add Tutorials section to navigation
	 *
	 * @since 3.4
	 * @author Remy Perona
	 *
	 * @param array $navigation Array of menu items.
	 * @return array
	 */
	public function add_tutorials_page( $navigation ) {
		$navigation['tutorials'] = [
			'id'               => 'tutorials',
			'title'            => __( 'Tutorials', 'rocket' ),
			'menu_description' => __( 'Getting started and how to videos', 'rocket' ),
		];
 
		return $navigation;
	}

7、打开:wp-rocket\inc\classes\admin\settings\class-render.php,删除146-156行。

/**
	 * Render the Tutorials page section.
	 *
	 * @since 3.4
	 * @author Remy Perona
	 */
	public function render_tutorials_section() {
		echo $this->generate( 'page-sections/tutorials' );
	}
 
	/**

8、打开:wp-rocket\assets\js\wpr-admin.js,搜索并删除以下代码。

,"tutorials"==this.pageId&&(this.$submitButton.style.display="none")

9、强迫症患者还可以删除wp-rocket\assets\css\wpr-admin.css 里的相关代码,哈哈哈哈!

至此,WP Rocket火箭缓存后台教程部分已经完全剔除,速度也上去了。

转载:https://www.yxt521.com/network/1542.html

温馨提示:本文最后更新于2020-03-25 20:48:48,某些文章具有时效性,若有错误或已失效,请在下方留言或联系站长
------本页内容已结束,喜欢请分享------

感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容