Skip to content

Instantly share code, notes, and snippets.

View soderlind's full-sized avatar

Per Søderlind soderlind

View GitHub Profile
soderlind / docker-compose.yml
Last active June 10, 2024 16:32
Buggregator for local WordPress development
condition: service_healthy
- # Sentry, Ray
- # SMTP
soderlind /
Last active January 23, 2024 16:06
WordPress Playground blueprint for a block plugin.

Live Preview for Jobbnorge Block

Plugin Previews are now available for opt-in, I've added a live preview to my block plugin

On, there are two things required for a plugin preview button to appear to all users:

  1. A valid blueprint.json file must be provided in the plugins assets/blueprints sub-directory.
  2. The plugin preview must be set to “public” from the plugin’s Advanced view by a committer.

Read the blueprint documentation for more information.

soderlind /
Last active December 19, 2023 03:21
Me talking with Copilot Chat

@soderlind: I need a bash script that read a list of domains from disk and use az cli to remove the domains from azure front door. I have several azure front doors in the resource group.

GitHub Copilot: Here's a step-by-step plan for the bash script:

  1. Define the script shebang to specify that the script should be run using bash.
  2. Read the file line by line using a while loop.
  3. Inside the loop, use the az network front-door frontend-endpoint delete command to delete the domain from each Azure Front Door in the resource group.
  4. The command requires the names of the resource group, the Front Door, and the endpoint (domain). You'll need to loop over each Front Door in the resource group.
  5. To get the list of Front Doors, use the az network front-door list command with the resource group name.
  6. Parse the output of the list command to extract the names of the Front Doors.
soderlind / hardcode-number-of-items.php
Created August 28, 2023 08:27
WordPress Admin: Hardcode max number of items per page.
* name
* @package Soderlind\MuPlugins\HardcodeNumberOfItems
* @author Per Soderlind
* @copyright 2021 Per Soderlind
* @license GPL-2.0+
soderlind / plausible-2f-fix.php
Last active May 25, 2023 09:53
Fix for Plausible Analytics %2f removal from shard link
* Plugin Name: Plausible 2f Fix
* Description: Fix for Plausible Analytics %2f removal from shard link.
* Plugin URI:
* License: GPL-2.0+
* License URI:
declare( strict_types = 1 );
add_action( 'muplugins_loaded',function() : void {
$my_rest_endpoint = '/wp-json/super-admin-all-sites-menu/v1/sites/';
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
* Bail if not the correct request.
soderlind / mu-super-admin-all-sites-menu.php
Last active April 7, 2022 11:37
Fast REST Response for Super Admin All Sites Menu (, save in mu-plugins
* name: Fast REST Response for Super Admin All Sites Menu
* @package Soderlind\Multisite\MU
* @author Per Soderlind
* @copyright 2021 Per Soderlind
* @license GPL-2.0+
* @wordpress-plugin
soderlind / webpack.config.js
Last active February 28, 2022 16:58
Add a banner to build/index.js, when running "wp-scripts build"
"use strict";
const defaultConfig = require("@wordpress/scripts/config/webpack.config");
const packageJSON = require("./package.json");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
module: {
soderlind / deploy-develop.yml
Last active December 22, 2021 08:59
GitHub Action: Deploy WordPress to Azure Container Registry
name: Development deploy
types: trigger-development-deploy
soderlind / example.php
Last active September 25, 2021 20:33
WordPress Multisite, gets all site transient keys in the database with a specific prefix.
foreach ( get_site_transient_keys_with_prefix( 'my_tranients_prefix_' ) as $transient ) {
delete_site_transient( $transient );