Skip to content

Instantly share code, notes, and snippets.

View sebastianmoran-archive's full-sized avatar

Sebastian Moran sebastianmoran-archive

  • Massachusetts
View GitHub Profile
<?php
/**
* Tweaks the query used for finding pages in the menus area so that if a number
* is entered in the search field, the query will look for a post with that ID
* instead of searching by the number.
*/
add_action( 'parse_query', function( $query ) {
// Only apply this to the menu quick search
if ( isset( $_POST['action'] ) && 'menu-quick-search' == $_POST['action'] ) {
<?php
class Joost_Comment_Fixes {
public function __construct() {
// Unhook comment cookies stuff from core.
remove_action( 'set_comment_cookies', 'wp_set_comment_cookies' );
add_action( 'wp_footer', [ $this, 'print_custom_comment_script' ] );
add_filter( 'wp_get_current_commenter', [ $this, 'ignore_comment_cookies_serverside' ] );
add_filter( 'comment_post_redirect', [ $this, 'comment_moderation_redirect' ], 10, 2 );
@pryley
pryley / uBlock hide pineapple.txt
Created December 19, 2024 04:13
This removes the petty pineapple checkbox from WordPress.org
! Add this to the uBlock Origin "My filters"
login.wordpress.org##+js(click-element, #pineapple)
login.wordpress.org##.login-pineapple
@lucprincen
lucprincen / Save.php
Last active December 18, 2024 13:05
Saves a WordPress FSE pattern on the local environment.
<?php
namespace WotW\Theme\Patterns;
use WotW\Theme\Contracts\Interfaces\Hookable;
class Save implements Hookable{
public function register_hooks(): void {
/**
* Adds "failed" status to Action Scheduler cleanup action.
*
* Default is "complete" and "canceled," leaving "failed" actions
* in the Action Scheduler to pile up indefinitely.
*
* Filter located in action-scheduler/classes/ActionScheduler_QueueCleaner.php
*
* @see https://wpcodebook.com/woocommerce-action-scheduler-cleanup-php/
*/
@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
*/
@nosilver4u
nosilver4u / frt-tweaks.php
Last active November 20, 2025 15:20
Force Regenerate Thumbnails Tweaks
<?php
/*
Plugin Name: Force Regenerate Thumbnails Tweaks
Version: 1.0.0
*/
// NOTE: This plugin will do nothing without alterations. Uncomment the add_filter() lines for the filters you wish to use.
// If necessary, edit them to your needs. Some filters simply turn things on/off by returning a true or false.
// For such filters, using WordPress' built-in __return_true() or __return_false() functions will work just fine, unless
// you wish to conditionally enable/disable a feature.
@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
*/