Skip to content

Instantly share code, notes, and snippets.

View presswizards's full-sized avatar
🎯
Working on: FreeScout GPT Pro, WAF Suite for Cloudflare

Rob Marlbrough @PressWizards presswizards

🎯
Working on: FreeScout GPT Pro, WAF Suite for Cloudflare
View GitHub Profile
@xyzulu
xyzulu / enhance_control_backup.sh
Last active December 10, 2025 16:04
Backup Enhance control panel server assets that are needed in the event of a server disaster
#!/bin/bash
##############################################################################
# At the least you will need to set the remote transfer credentials and paths.
# This script will keep 14 days of backups on your destination host.
##############################################################################
TEMP_DIR="/temp"
TIMESTAMP=$(date +%Y%m%d%H%M%S)
ARCHIVE_NAME="$TEMP_DIR/control-backup_$TIMESTAMP.tar.gz"
@presswizards
presswizards / add_trusted_ips.sh
Created July 11, 2024 08:05
Plesk Add Trusted IPs to fail2ban to prevent badbot blocks
#!/bin/bash
# add to crontab to run once per day or week like so via "crontab -e":
# 0 0 */1 * * ~/add_trusted_ips.sh > /dev/null
# URL containing the list of trusted IPs
URL1="https://optimize.exactlywww.com/exactdn/servers.php"
URL2="https://www.cloudflare.com/ips-v4/"
URL3="https://www.cloudflare.com/ips-v6/"
URL4="https://api.bunny.net/system/edgeserverlist/plain"
@clifgriffin
clifgriffin / check-urls.php
Created February 15, 2023 13:32
Check URLs to see if they are on Shopify or WooCommerce
<?php
/**
* Instructions: cd into site directory
*
* Run `wp eval-file ./path/to/script.php`
*/
global $wpdb;
// Query
@presswizards
presswizards / blesta-affiliate-id.php
Last active July 11, 2024 08:09
Add Blesta Affiliate ID to all links on page
add_action( 'wp_head', function () { ?>
<script>
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
<?php
/**
* Displays the post modified date.
*
* @package There is no package.
*/
/**
* Returns the last modified date for the post with the <time> tag and the
* time zone.
@seezee
seezee / feed-offset-template.php
Last active November 25, 2022 22:28
Customized WordPress RSS Feed. REPLACE the value of the variable $date before employing!
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
* Adds an offset of "1" to display all but most recent
*
* Full details at:
* https://wordimpress.com/anatomy-advanced-wordpress-blog-notification-email
*
* @package Your Package Name
*/
@seezee
seezee / webp.php
Last active March 23, 2025 19:34
WEBP for WordPress
<?php
/**
* Support for WEBP.
*
* @package myplugin
*/
// Security.
if ( ! defined( 'ABSPATH' ) ) {
die( 'Sorry, you are not allowed to access this page directly.' );
@UVLabs
UVLabs / make-pot.sh
Last active July 16, 2024 04:58
Using WordPress makepot.php to generate pot file used for the internationalization of your plugin or theme.
#!/bin/bash
php path/to/makepot.php wp-plugin /path/to/your/plugin pluginname.pot
#php path/to/makepot.php wp-theme /path/to/your/theme themename.pot
@jamescridland
jamescridland / reports.php
Last active October 15, 2024 14:36
An additional API for Sendy, that offers a report for a specific sent campaign
<?php include('../_connect.php');?>
<?php include('../../includes/helpers/short.php');?>
<?php
/*
---Little helper function from [email protected] for reporting
Put this file in a new folder within the /api/ folder, called "reporting", and call it "reports.php". (Or whatever you like).
Call by POST to api/reporting/reports.php with the following mandatory elements
'api_key' => (your API key)
'brand_id' => 1
'label' => (the campaign name)
@wpscholar
wpscholar / create-admin-user.php
Last active January 30, 2025 17:31
Create a new admin user in WordPress via code. Drop this file in the mu-plugins directory and update the variables, then load a page in WordPress to create the user. Remove the file when done.
<?php
add_action( 'init', function () {
$username = 'admin';
$password = 'password';
$email_address = '[email protected]';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );