Skip to content

Instantly share code, notes, and snippets.

View soderlind's full-sized avatar

Per Søderlind soderlind

View GitHub Profile
@soderlind
soderlind / README.md
Last active May 13, 2025 01:29
Enable WordPress Customizer Preview on Mapped Domain
@soderlind
soderlind / README.md
Last active March 22, 2025 21:39
Sticky WP Table Header

Sticky WP Table Header

This plugin will make the table header sticky when you scroll down.

Save file in wp-content/mu-plugins

position: sticky is supported by most browsers.

@soderlind
soderlind / README.md
Last active February 13, 2025 11:06
Create a WordPress custom search
@soderlind
soderlind / README.md
Last active May 8, 2025 13:43
Delete failed and cancelled GitHub Actions workflow runs for a given workflow

Delete failed and cancelled GitHub Actions workflow runs

The script will remove failed and cancelled workflow runs from your GitHub Action workflow history log.

failed-workflow-run

Prerequisite

@soderlind
soderlind / README.md
Last active December 21, 2024 11:57
Semgrep Static Application Security Testing for PHP, code added using composer.

Semgrep SAST (Static Application Security Testing) for WordPress

I use this GitHub Action to security test our WordPress themes

So what does the GitHub Action do?

It;

@soderlind
soderlind / README.md
Last active December 18, 2024 18:08
Favorite keybindings in Visual Studio Code: Select next file or next workspace

Favorite keybindings in Visual Studio Code

First, disable multible tabs: Set Workbench > Editor: Show Tabs to single

Included in VS Code:

  • Control+Tab: Next File
  • Shift+Control+Tab: Previous File

Custom, add the code in keybindings.json to VS Code (Shift+Command+P, select Preferences: Open Keybord Shortcuts (JSON))

  • Option+Tab: Next Workspace (file picker)
@soderlind
soderlind / README.md
Last active May 20, 2025 16:16
WordPress Web Application Firewall (WAF) Custom rules for Azure Front Door (AFD)
@soderlind
soderlind / waf-policy.bicep
Last active September 19, 2024 10:40
WordPress: Use Azure Front Door to rate limit access the login page
resource wafPolicy 'Microsoft.Network/FrontDoorWebApplicationFirewallPolicies@2022-05-01' = {
name: wafPolicyName
location: 'global'
sku: {
name: frontDoorSkuName
}
tags: tags
properties: {
policySettings: {
enabledState: 'Enabled'
@soderlind
soderlind / README.md
Last active September 11, 2024 08:30
WordPress: Add a media inserter to the block editor using the registerInserterMediaCategory

I did this to show how easy it is to create your own media inserter. In production I would create a a server that returns the json.

Install

  1. Create a block
    • in wp-content/plugins run npx @wordpress/create-block@latest my-image-inserter
    • cd my-image-inserter
  2. Copy index.js to my-image-inserter/src/index.js
  3. Delete my-image-inserter/my-image-inserter.php
  4. Copy plugin.php to my-image-inserter/plugin.php
@soderlind
soderlind / copilot.aliases.zshrc
Last active July 6, 2024 14:07
GitHub Copilot CLI aliases
# GitHub CLI aliases
eval "$(gh copilot alias -- zsh)" # or bash
# Old school aliases
alias '??'='ghcs'
alias 'git?'='ghcs -t git'
alias 'gh?'='ghcs -t gh'
alias 'explain'='ghce'