Skip to content

Instantly share code, notes, and snippets.

View sabrina-zeidan's full-sized avatar

Sabrina Zeidan sabrina-zeidan

View GitHub Profile
@MaximeCulea
MaximeCulea / wp-multinetwork.php
Last active April 2, 2020 18:08
Cheatset for multinetwork
<?php
/**
* Grant newly superadmin user to all networks when working in a multi-network context
* @author Maxime CULEA
*/
add_action( 'grant_super_admin', 'superadmin_is_superadmin_for_all_networks' );
function superadmin_is_superadmin_for_all_networks( $user_id ) {
remove_action( 'grant_super_admin', 'superadmin_is_superadmin_for_all_networks' );
global $wpdb;
@geoffyuen
geoffyuen / wp-cli.md
Last active February 16, 2023 06:07
WP CLI Cheatsheet

WP CLI cheatsheet

You may need to be at the root of your WP install. In Local by Flywheel this will be the app directory.

Backup database

wp db export your/path/here/my_wordpress_db.sql

Import database

@jaredatch
jaredatch / functions.php
Last active February 28, 2022 22:04
WordPress Search Autocomplete using WP REST API v2
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@kasparsd
kasparsd / clone-popular.sh
Last active January 3, 2024 16:06
Get the top 1000 most popular plugins on WordPress.org
@azizultex
azizultex / Remove an Action from a Plugin Class Method WordPress
Last active November 29, 2023 11:43
Remove a hook, filters from a Plugin Class Method WordPress
/**
* Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :)
* source: https://github.com/herewithme/wp-filters-extras
* More: http://wordpress.stackexchange.com/questions/57079/how-to-remove-a-filter-that-is-an-anonymous-object
*/
function remove_filters_for_anonymous_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) {
global $wp_filter;
// Take only filters on right hook name and priority
if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) )
@DavidWells
DavidWells / add-wordpress-settings-page.php
Created January 28, 2013 05:59
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters