Skip to content

Instantly share code, notes, and snippets.

View sebastianmoran-mainwp's full-sized avatar
🚀
Fast Lane Strategies: Turbocharging Your WordPress Website for Optimal Speed.

Sebastian Moran sebastianmoran-mainwp

🚀
Fast Lane Strategies: Turbocharging Your WordPress Website for Optimal Speed.
View GitHub Profile
@matiasbenedetto
matiasbenedetto / functions.php
Created March 22, 2024 15:26
Filter WordPress font_dir directory to change the default font path to /wp-content/upload/fonts
<?php
function filter_default_font_directory( $font_directory ) {
$upload_dir = wp_get_upload_dir();
$font_directory = array(
'path' => untrailingslashit( $upload_dir['basedir'] ) . '/fonts',
'url' => untrailingslashit( $upload_dir['baseurl'] ) . '/fonts',
'subdir' => '',
'basedir' => untrailingslashit( $upload_dir['basedir'] ) . '/fonts',
@bacoords
bacoords / social-icons.php
Last active November 17, 2023 15:35
Filter the social icons block.
<?php
/**
* Filter the social icons block.
*
* @param string $block_content The block content.
* @param array $block The block.
*
* @return string
*/
function filter_social_icons_block( $block_content, $block ) {
@ideadude
ideadude / Affiliate_WP_PMP.php
Created November 5, 2023 14:17
Jason Fixed the PMP integration for AffiliateWP 2 years ago and they never updated it. Here's the old code.
<?php
/**
* Integrations: Paid Memberships Pro
*
* @package AffiliateWP
* @subpackage Integrations
* @copyright Copyright (c) 2016, Sandhills Development, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.8
*/
@wpmudev-sls
wpmudev-sls / defender-whitelabel-emails.php
Last active September 29, 2022 20:41
[Defender Pro] - Whitelabel ALL Defender emails
<?php
/**
* Plugin Name: [Defender Pro] - White Label ALL Defender emails
* Description: Allows the modification of almost all email fields/parameters via filters or an additional GUI at Settings > General.
* Author: Anderson Salas @ WPMUDEV
* Task: SLS-3842
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
@wpmudev-sls
wpmudev-sls / wdf-wc-2fa-my-account.php
Last active September 29, 2022 20:40
[Defender Pro] - 2FA setup page integration for WooCommerce (and others)
<?php
/**
* Plugin Name: [Defender Pro] - 2FA setup page integration for WooCommerce (and others)
* Description: Moves the 2FA setup page to the 'My Account' WC page, and restricts the shop navigation util it's completed
* Author: Anderson Salas @ WPMUDEV
* Task: SLS-3822
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
<?php
/**
* Plugin Name: [Smush] - Beaver fix image not serving via CDN.
* Plugin URI: https://wpmudev.com/
* Description: Beaver Builder not serving images via CDN.
* Author: Abdoljabbar Bakhshande
* Author URI: https://wpmudev.com/
* Task: SLS-3724
* License: GPLv2 or later
*
@trainingspark
trainingspark / anonymise-users.php
Last active December 22, 2023 06:22
A simple script to quickly anonymise the users of a WordPress website.
<?php
/*
A simple script to quickly anonymise the users of a WordPress website.
It works by replacing all of your existing users with new randomly generated user details.
Simply add this file to the root directory of your WordPress installation, then go to <<your website address/>>/anonymise-users.php
@CapWebSolutions
CapWebSolutions / sec-scan-root.sh
Last active April 23, 2024 15:47
Latest iteration of security scanning script for MainWP instance.
#
# This script is executed from a terminal prompt at the root of your MainWP WordPress website.
# It uses the same services as WP CLI, so if WP CLI runs, this should also.
#
# Execute MainWP CLI command to generate a list of all configured sites in MainWP
# Pipe output through filter to remove columns 3 and 4 of output. These columns hold the 2 digit site number. Adjust if more than 99 sites.
# Pipe that output to get rid of the comment lines in the site listing.
# Pipe that output through the SED editor inserting the security scan command at the beginning of the line
# Send everything to a shell script to be executed.
cd /var/www/capwebwpcare.com/htdocs
@luiseduardobraschi
luiseduardobraschi / functions.php
Last active August 19, 2022 08:06
Remove country and city fields from shipping calculator and disable "calculate shipping" toggle non-sense.
<?php
add_filter( 'woocommerce_shipping_calculator_enable_country', '__return_false' );
add_filter( 'woocommerce_shipping_calculator_enable_city', '__return_false' );
@timmyc
timmyc / woocommerce-remove-db-update-notice.php
Created April 10, 2020 21:08
Set WooCommerce DB Update Notice as Actioned
<?php
/**
* Plugin Name: Remove WooCommerce DB Notice
* Plugin URI: https://woocommerce.com
* Description: Clears out any pending WooCommerce DB Update notices
* Author: WooCommerce
* Domain Path: /languages
* Version: 0.1
*/