Skip to content

Instantly share code, notes, and snippets.

View lightningspirit's full-sized avatar
🏠
Working from home

Vitor Carvalho lightningspirit

🏠
Working from home
View GitHub Profile
@lightningspirit
lightningspirit / README.md
Last active August 22, 2022 00:07
Fix WordPress REST base to use real URL

WordPress REST base on Site URL

If you change the site URL option to use a different one from your installed directory, the /wp-json/ is base changes too. This plugin fixes that.

Usage

  1. Download a ZIP of this plugin
  2. Upload to WordPress
@lightningspirit
lightningspirit / README.md
Last active June 22, 2022 18:50
WPGraphQL search by field with regular expressions support

WPGraphQL search by field with regular expressions support

Adds a where field to WPGraphQL content nodes (post, page and custom post types) to search by field using regexp or like. Supported fields are name, title, author, excerpt, status and mime_type.

Usage

  1. Install WPGraphQL
  2. Download or copy the wpgraphql-search-field.php file
  3. Place it under wp-content/mu-plugins
  4. Done
@lightningspirit
lightningspirit / README.md
Last active September 26, 2022 15:50
WPGraphQL add field format plain text

WPGraphQL add field format plain text

This small plugin adds a new format to retrieve excerpt or title in text plain format instead of rendered.

Usage

  1. Install WPGraphQL
  2. Download or copy the wpgraphql-field-format-text-plain.php file
  3. Place it under wp-content/mu-plugins
  4. Done
[{
"id": "year",
"type": "year",
"label": "Em que ano ficou desempregado/a",
"min": 2008
},
{
"id": "month",
"type": "select",
"label": "E em que mês",
@lightningspirit
lightningspirit / distributed-event-system.ts
Created April 29, 2022 16:55
A distributed event system for Node.js using Redis as storage system
import { createClient } from "redis"
type Listener = <E extends Event>(event: E) => void
/**
* Atomic distributed memory accross nodes
* backed by Redis server.
*/
class DistributedMemory {
/**
@lightningspirit
lightningspirit / contentdb.ts
Created April 29, 2022 16:54
ContentDB - A tiny JS cache-in-disk database for embeddable systems
import { promises as fs } from "fs"
import path from "path"
export interface NodeItem {
id: string
data: any
}
const cache: NodeItem[] = []
@lightningspirit
lightningspirit / elementor-s3-uploads.php
Created February 24, 2022 13:28
Some WordPress Mu-plugins
<?php
/**
* Plugin Name: Elementor S3
* Description: Elementor support for S3 Uploads plugins
* Plugin URI: https://gist.github.com/lightningspirit/73df703f0db1fef14bd30d64ea1e8631
* Author: Move Your Digital, Inc.
* Author URI: https://moveyourdigital.com
* Version: 0.1.0
*
@lightningspirit
lightningspirit / README.md
Created February 17, 2022 21:46
Disable WordPress Admin Bar MU-Plugin

Disable WordPress Admin Bar MU-Plugin

Disable the admin bar for all users automatically.

Usage

  1. Download or copy the disable-admin-bar.php file
  2. Place it under wp-content/mu-plugins
  3. Done
@lightningspirit
lightningspirit / README.md
Last active July 7, 2022 11:17
WordPress Autoload Composer Vendor MU-Plugin

WordPress composer autoload

Do you use WordPress along with composer? This is the right plugin for you. Just add it to mu-plugins and the root autoloader is activated.

Usage

  1. Download or copy the autoload.php file
  2. Place it under wp-content/mu-plugins
  3. Done
@lightningspirit
lightningspirit / README.md
Last active November 19, 2024 11:32
WordPress Multisite Network Plugin management

WordPress Multisite Network Plugin management

For multisite network ONLY Adds a new Plugins tab under wp-admin/network/sites.php which gives the ability to enable or disable (without actually activate) plugins per site.

This just "hides" not enabled plugins from the site plugins area.

Note: the super-admin can still have access to all plugins, even for each specific website which is great because the super-admin can activate hidden plugins :-)