This file contains hidden or 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 | |
add_filter( 'password_needs_rehash', 'mu_plugin_mdms_prevent_password_rehashing', 11, 3 ); | |
/** | |
* Maybe prevent password rehashing, limit rehashing to a set-up time-slot. | |
* This filter is only effective in WordPress 6.8 and up, and when not overriding the $wp_hasher global variable. | |
* This is to prevent the password rehashing from happening too often, which WILL cause users forced being logged in every time they switch to a different domain subsite. | |
* | |
* @param bool $needs_rehash Whether the password needs rehashing, defaults to true. | |
* While this could also be false; the way WordPress is set-up, |
This file contains hidden or 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 | |
// mu-plugin or included in theme/plugin | |
add_filter( 'posts_search', 'maybe_search_by_title_only', 10, 2 ); | |
// add query var 'title_only' to the allowed query vars. | |
add_filter( 'query_vars', function ( $vars ) { | |
$vars[] = 'title_only'; | |
return $vars; |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Convert a stand-alone WordPress site to a multisite without using the MS Setup. | |
# The Set-Up wizard requires you to deactivate all plugins, but you might not want to do that. | |
# This script helps. | |
# | |
# NOTE: No warranty, use at own risk. Has no checks for existing multisite, it assumes this is a single site installation | |
# This script ASSUMES YOU KNOW WHAT YOU ARE DOING, and so do I. | |
CTM_DB_PREFIX="$1" |
This file contains hidden or 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
#!/usr/bin/env bash | |
# example usage: cd ~/Local\ Sites ; find ./*/app/.idea/workspace.xml -exec patch-workspace.sh {} \; | |
[ -z "$1" ] && echo "Usage: $0 filepath-to-workspace.xml" >&2 && exit 1; | |
xmlpath="$1" | |
[ ! -f "$xmlpath" ] && echo File not found: $1 && echo "Usage: $0 filepath-to-workspace.xml" >&2 && exit 2; | |
cp "$xmlpath" "$xmlpath.bak" |
This file contains hidden or 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 | |
// This tool is 80% ChatGPT code. Just so you know. | |
error_reporting( -1 ); | |
ini_set('display_errors', 'on'); | |
// === CONFIGURATION === | |
$config = [ | |
'servers' => [ 'srv1.mail.example.com', 'srv2.mail.example.com', ], | |
'timeout' => 10, // seconds |
This file contains hidden or 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
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"palette": { | |
"black": "#262B44", | |
"blue": "#4B95E9", | |
"green": "#59C9A5", | |
"orange": "#F07623", | |
"red": "#D81E5B", | |
"white": "#E0DEF4", | |
"yellow": "#F3AE35" |
This file contains hidden or 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
#!/bin/bash | |
# A script to generate a changelog by comparing composer packages and project commits. | |
# | |
# Disclaimer: | |
# - Using this script is at your own risk. This script only uses READ operations, but I still | |
# do not take any responsibility. | |
# | |
# License: | |
# - BSD 2-Clause — Free to use with attribution. No warranty provided. | |
# |
This file contains hidden or 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 | |
// Make local URLs domainless, for all styles and scripts, to combat CORS issues. | |
// Ideally, we fix this in .htaccess using conditional headers, but in case of nginx, that's not available. | |
add_filter( 'script_loader_src', 'make_local_urls_domainless', 10 ); | |
add_filter( 'style_loader_src', 'make_local_urls_domainless', 10 ); | |
function make_local_urls_domainless( $url ) { | |
global $wpdb; | |
$all_domains = $wpdb->get_col( "SELECT domain FROM {$wpdb->blogs} ORDER BY blog_id DESC" ); |
This file contains hidden or 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 | |
/** | |
* Maybe login by cookie. | |
* This function will log in a user by their authentication cookie, if they have one. | |
* This will use a full authentication, so it is safe from cookie-faking. | |
* Cookie hijacking is still a possibility, however, that's a WordPress issue, not a plugin issue. | |
* (To combat this; prefix the salts in wp-config.php with $_SERVER['REMOTE_ADDR']. This is not watertight, | |
* but always better than not) | |
* | |
* Call this function in your `permission_callback`, or in case of `__return_true` in your `callback` for getting items. |
This file contains hidden or 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
# changes-to--php.ini.hbs | |
... | |
disable_functions = dns_get_record | |
... | |
auto_prepend_file = /path/to/the/dns_get_record_polyfill.php | |
... | |
# Changelog: | |
# - May 22nd, 2025; | |
# - - updated to support wildcard domain registrations, seems CloudFlare does not handle that themselves. |
NewerOlder