Last active
May 30, 2024 13:04
-
-
Save wpmudev-sls/762e09e746258afa64ed98f5cf32eba9 to your computer and use it in GitHub Desktop.
[THC] - Remove WP admin references from the hub client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: [The Hub Client] Remove WP Admin references | |
* Description: Removes WP Admin references from the hub page. | |
* Author: Prashant @ WPMUDEV | |
* Task: SLS-6140 | |
* Author URI: https://premium.wpmudev.org | |
* License: GPLv2 or later | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly. | |
} | |
function wpmudev_remove_wp_ref_thc() { | |
?> | |
<style> | |
a.dev-hub-service-info__item.dev-hub-service-info__item--wp.undefined { | |
display: none; | |
} | |
.hui-breadcrumbs-action-item { | |
display: none; | |
} | |
.hui-breadcrumbs-action-item.hui-breadcrumbs-action-item--more { | |
display: block; | |
} | |
.shui-site-tab-card.shui-site-tab-card--service.hub-site-info-card { | |
display: none; | |
} | |
</style> | |
<script type="text/javascript"> | |
window.onpopstate = history.onpushstate = function(e) { | |
setTimeout(function(){ | |
var els = document.querySelectorAll("a"); | |
for (var i = 0, l = els.length; i < l; i++) { | |
var el = els[i]; | |
if ( el.href.includes('/wp-admin') ) { | |
el.href = 'javascript:void(0);'; | |
} | |
} | |
},4000); | |
setTimeout(function(){ | |
var els = document.querySelectorAll("a"); | |
for (var i = 0, l = els.length; i < l; i++) { | |
var el = els[i]; | |
if ( el.href.includes('/wp-admin') ) { | |
el.href = 'javascript:void(0);'; | |
} | |
} | |
},8000); | |
}; | |
setTimeout(function(){ | |
var els = document.querySelectorAll("a"); | |
for (var i = 0, l = els.length; i < l; i++) { | |
var el = els[i]; | |
if ( el.href.includes('/wp-admin') ) { | |
el.href = 'javascript:void(0);'; | |
} | |
} | |
},9000); | |
setTimeout(function(){ | |
var els = document.querySelectorAll("a"); | |
for (var i = 0, l = els.length; i < l; i++) { | |
var el = els[i]; | |
if ( el.href.includes('/wp-admin') ) { | |
el.href = 'javascript:void(0);'; | |
} | |
} | |
},10000); | |
</script> | |
<?php | |
} | |
add_action( 'wpmudev_hub_template_footer', 'wpmudev_remove_wp_ref_thc' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment