Skip to content

Instantly share code, notes, and snippets.

@retlehs
retlehs / block-styles.jsx
Created May 14, 2026 21:07
Multiple select for block styles
/**
* Multi-select block styles for Gutenberg, with live preview popovers.
*
* Gutenberg's built-in Block Styles panel is single-select: picking one
* "is-style-*" class swaps out any other. That makes it impossible to
* combine, say, a "size" style with a "decoration" style on the same
* block see https://github.com/WordPress/gutenberg/issues/14598
* (open since 2019).
*
* This module replaces the core panel for the blocks listed in
@retlehs
retlehs / google-listings-and-ads-detach-bundled-monolog-and-psr-log.patch
Created May 5, 2026 17:08
Google for WooCommerce patch to avoid `psr/log` and `monolog/monolog` conflicts with Acorn
--- a/src/Autoloader.php
+++ b/src/Autoloader.php
@@ -39,6 +39,8 @@
return false;
}
+ self::detach_host_namespaces( $autoloader_result );
+
return $autoloader_result;
}
@retlehs
retlehs / 2026-04-29-closed-plugins.md
Last active April 29, 2026 22:48
WordPress.org plugins closed on 2026-04-29T16:02:25Z
@retlehs
retlehs / CC.md
Last active May 13, 2026 09:41
Backlinks for any domain via Common Crawl
@retlehs
retlehs / wp-docs-md-bookmarklet.md
Created August 7, 2025 17:57
WordPress.org Developer Docs to Markdown Bookmarklet

WordPress.org Developer Docs to Markdown Bookmarklet

Quick and dirty way to convert a WordPress developer documentation page into Markdown.

javascript:(function(){const turndownScript=document.createElement('script');turndownScript.src='https://unpkg.com/turndown/dist/turndown.js';turndownScript.onload=()=>{const turndownService=new TurndownService({gfm:true,headingStyle:'atx',codeBlockStyle:'fenced'});turndownService.addRule('table',{filter:'table',replacement:function(content,node){let markdownTable='\n';const rows=Array.from(node.querySelectorAll('tr'));const headerCells=Array.from(rows[0].querySelectorAll('th'));const columnCount=headerCells.length;let headerRow=headerCells.map(cell=>cell.textContent).join(' | ');let separatorRow=Array(columnCount).fill('---').join(' | ');markdownTable+=`| ${headerRow} |\n`;markdownTable+=`|${separatorRow}|\n`;for(let i=1;i<rows.length;i++){const cells=Array.from(rows[i].querySelectorAll('td'));const cellContent=cells.map(cell=>cell.textContent).join(' |
@retlehs
retlehs / woocommerce-shipping-ups-remove-psr-log.patch
Created July 18, 2025 18:41
WooCommerce patches to avoid `psr/log` conflicts with Acorn
diff --git a/vendor/composer/jetpack_autoload_classmap.php b/vendor/composer/jetpack_autoload_classmap.php
index 1855b18..d52edf3 100644
--- a/vendor/composer/jetpack_autoload_classmap.php
+++ b/vendor/composer/jetpack_autoload_classmap.php
@@ -194,50 +194,50 @@ return array(
'version' => '3.1.3',
'path' => $vendorDir . '/automattic/jetpack-autoloader/src/class-plugins-handler.php'
),
- 'Psr\\Log\\AbstractLogger' => array(
- 'version' => '1.1.4.0',
@retlehs
retlehs / sync-prod.sh
Last active January 19, 2026 23:53
WP-CLI aliases sync example
read -r -p "Would you really like to reset your development database and pull the latest from production? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
wp @development db reset --yes &&
wp @production db export - > sql-dump-production.sql &&
wp @development db import sql-dump-production.sql &&
wp @development search-replace https://example.com https://example.dev
fi
diff U3 a/wp/wp-includes/load.php b/wp/wp-includes/load.php
--- a/wp/wp-includes/load.php Tue Feb 02 19:38:52 2016
+++ b/wp/wp-includes/load.php Tue Feb 02 19:58:21 2016
@@ -285,7 +285,7 @@
*/
function wp_debug_mode() {
if ( WP_DEBUG ) {
- error_reporting( E_ALL );
+ error_reporting( E_ALL & ~E_DEPRECATED );
@retlehs
retlehs / gist:e5683cb8377e1b1836ab
Created May 26, 2015 16:26
Don't be scared of Sage

This is from a comment on the Advanced WordPress Facebook group by Kevin Hoffman.


Disclaimer: I'm not affiliated with Roots, just a satisfied user.

In response to several recent questions on the topic of starter themes, the following are my thoughts on what I believe is the best starter theme available today, along with a heads-up on an upcoming resource that may help you in the near future.

Recommendations for starter themes come up quite often in AWP, and my first instinct is to recommend Roots' Sage starter theme (https://roots.io/sage/), but to be honest, it's not for everyone. I feel like I always have to attach the caveat concerning the prerequisites: Node.js, gulp, Bower, CSS preprocessing, build processes, etc. I often see advanced devs discouraging others from trying Sage if they're not 100% up to date on all of these tools. Don't let that scare you.