Useful Tip: How to Change Plugin and Admin Toolbar Links to “Purge Cache”

[ad_1]

*** Useful Tip ***

Consistency and simplicity are always a winner.

The code snippet provided below changes all plugin instances of “Delete Cache” and “Clear Cache” to “Purge Cache.” In order for the code snippet to work, it must be added to your functions.php file and activated for both the backend and frontend of your website.

After activating the code snippet, this is what you’ll see:

Backend: https://prnt.sc/YhOU5FkWKHtV
Frontend: https://prnt.sc/JzPg8H-2kIg5

Enjoy!

—————–

// BACKEND: Change WP Fastest Cache "Delete Cache" and "Clear Cache" Strings to "Purge Cache"

function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Delete Cache' :
$translated_text="Purge Cache";
break;
case 'Clear All Cache' :
$translated_text="Purge Cache";
break;
case 'Delete Cache and Minified CSS/JS' :
$translated_text="Purge Cache and Minified CSS/JS";
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );

// FRONTEND: Change WP Fastest Cache "Delete Cache" and "Clear Cache" Strings to "Purge Cache"

function change_admin_bar_main_link() {
if ( ! is_admin() ) {

global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent');

$args = array(
'id' => 'wpfc-toolbar-parent',
'title' => 'Purge Cache',
);

$wp_admin_bar->add_node($args);
}}
add_action('wp_before_admin_bar_render', 'change_admin_bar_main_link', 20, 3);

function change_admin_bar_sub_links() {
if ( ! is_admin() ) {

global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-delete-cache');

$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-delete-cache',
'title' => 'Purge Cache',
);

$wp_admin_bar->add_node($args);

global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-clear-cache-of-this-page');

$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-clear-cache-of-this-page',
'title' => 'Purge Cache of this Page',
);

$wp_admin_bar->add_node($args);

global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-delete-cache-and-minified');

$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-delete-cache-and-minified',
'title' => 'Purge Cache and Minified CSS/JS',
);

$wp_admin_bar->add_node($args);

}}
add_action('wp_before_admin_bar_render', 'change_admin_bar_sub_links', 20, 3);

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer