Skip to content

Instantly share code, notes, and snippets.

View mindctrl's full-sized avatar

John Parris mindctrl

View GitHub Profile
@mindctrl
mindctrl / wp-mail-smtp-disable-usage-tracking.php
Created December 6, 2025 04:02
Disable WP Mail SMTP usage tracking
<?php
add_action( 'plugins_loaded', function() {
add_filter( 'wp_mail_smtp_usage_tracking_is_enabled', '__return_false' );
} );
@mindctrl
mindctrl / wpforms-disable-usage-tracking.php
Created December 6, 2025 03:58
Disable WPForms usage tracking
<?php
add_action( 'plugins_loaded', function() {
add_filter( 'wpforms_usagetracking_is_allowed', '__return_false' );
} );
@mindctrl
mindctrl / remove-wp-mail-smtp-submenus.php
Last active November 10, 2025 21:46
Remove spammy WP-Mail-SMTP submenus
<?php
add_action( 'admin_menu', function() {
remove_submenu_page( 'wp-mail-smtp', 'wp-mail-smtp-reports' );
remove_submenu_page( 'wp-mail-smtp', 'wp-mail-smtp-logs' );
remove_submenu_page( 'wp-mail-smtp', 'wp-mail-smtp-about' );
global $submenu;
unset( $submenu['wp-mail-smtp'][5] );
}, 100 );
@mindctrl
mindctrl / dev-site-blogname.php
Created February 21, 2025 18:37
Prepends "(DEV)" to blog name
add_filter( 'option_blogname', 'jp_dev_blogname' );
/**
* Prepend '(DEV) ' to blog name
*/
function jp_dev_blogname( $value ): string {
return '(DEV) ' . $value;
}
@mindctrl
mindctrl / organize-wp-admin-menu-sidebar.php
Last active November 14, 2025 12:00
Move all non-core WordPress admin menu items to the bottom of the sidebar
<?php
add_action( 'admin_menu', 'jp_reorder_admin_menu', 999 );
/**
* Reorder wp-admin sidebar menus
*/
function jp_reorder_admin_menu() {
global $menu;
if ( empty( $menu ) ) {
return;
}
@mindctrl
mindctrl / move-jetpack-menu.php
Created January 9, 2025 18:00
Move Jetpack menu to bottom of wp-admin
<?php
add_action( 'admin_menu', function() {
global $menu;
// Find the Jetpack menu
$jetpack_menu = false;
foreach ( $menu as $key => $menu_item ) {
if ( $menu_item[2] === 'jetpack' ) {
$jetpack_menu = $menu[$key];
unset( $menu[$key] ); // Remove it from the current position
@mindctrl
mindctrl / customize-wpforms-menu.php
Created January 8, 2025 02:29
Move and rename WPForms menu in wp-admin
<?php
add_action( 'admin_menu', function() {
global $menu;
// Find the WPForms menu (wpforms-overview)
$wpforms_menu = false;
foreach ( $menu as $key => $menu_item ) {
if ( $menu_item[2] === 'wpforms-overview' ) {
$wpforms_menu = $menu[$key];
unset( $menu[$key] ); // Remove it from the current position
@mindctrl
mindctrl / jp-disable-some-plugin-updates.php
Created September 11, 2024 17:06
Programmatically disable updates for specific WordPress plugins
<?php
/**
* Plugin Name: JP Plugin Update Disabler
* Description: Disables plugin updates for specified plugins.
* Version: 1.0
* Author: John Parris
*/
add_filter( 'http_request_args', 'jp_disable_plugin_updates', 10, 2 );
function jp_disable_plugin_updates( $args, $url ) {
if ( str_starts_with( $url, 'https://api.wordpress.org/plugins/update-check/1.1/' ) ) {
@mindctrl
mindctrl / whatever.js
Created September 11, 2024 17:00
JavaScript to unsubscribe from GitHub comments/issues/PRs/whatever
// Why? Because GitHub's UI only allows 25 at a time, and doing it manually with a mouse is annoying.
// With this you can just paste in the console and press enter, wait for reload, do it again.
// I'm sure there's a "better" way, but I did not want to dive into their API docs for a one-time thing.
// Click the Select All checkbox
var el = document.querySelector('[aria-labelledby="select-all-subscriptions-text"]');
el.click();
// Click the Unsubscribe button
var un = document.querySelector('button.ml-3');
@mindctrl
mindctrl / remove-wpforms-menus.php
Last active November 10, 2025 21:43
Remove WPForms admin menu spam
<?php
add_action( 'admin_menu', function() {
remove_submenu_page( 'wpforms-overview', 'wpforms-analytics' );
remove_submenu_page( 'wpforms-overview', 'wpforms-smtp' );
remove_submenu_page( 'wpforms-overview', 'wpforms-about' );
remove_submenu_page( 'wpforms-overview', 'wpforms-community' );
remove_submenu_page( 'wpforms-overview', 'wpforms-wpconsent' );
}, 100 );