Skip to content

Instantly share code, notes, and snippets.

View cdevroe's full-sized avatar
:octocat:
Probably writing.

Colin Devroe cdevroe

:octocat:
Probably writing.
View GitHub Profile
@cdevroe
cdevroe / set-guid-to-permalink.php
Created February 1, 2024 13:55
A WordPress filter to change a post's GUID from ?p=int to its permalink (use with caution)
@cdevroe
cdevroe / hubbub_filter_acf.php
Last active March 27, 2025 19:51
Extended Hubbub Pro's Save This email to include a link from an ACF field
<?php
function hubbub_save_this_filter_add_book_button( $email_message, $post_id, $is_shortcode ) {
if (class_exists('ACF')) { // Check to make sure Advanced Custom Fields is active
$bookURL = get_field( $selector, $post_id );
if ( ! $bookURL ) $bookURL = '';
$email_message = str_replace( '{BOOK_BUTTON}', '<a href="' . $bookURL .'">Download Book</a>', $email_message );
}
@cdevroe
cdevroe / filter.php
Created April 6, 2026 18:20
Enable Hubbub Pro's Pinterest Image Hover button on select pages even with the tool off
<?php
/**
* Enable Grow's Pinterest Image Hover button only on specific page slugs.
*
* Replace the slugs below with your allowed pages.
* Examples:
* - 'about'
* - 'contact'
* - 'recipes/breakfast' (for nested pages)
*/
@cdevroe
cdevroe / hubbub-save-this-flodesk-metadata.php
Created April 8, 2026 11:09
Send custom field metadata to Flodesk using Hubbub Save This
<?php
/**
Add subscriber metadata to Flodesk using Hubbub Save This
https://morehubbub.com/
https://morehubbub.com/docs/save-this-actions-and-filters/
Important: in Flodesk, custom_fields keys need to
match real Flodesk custom field keys. If your fields are
not keyed exactly post_id, post_title, and post_url,
replace those array keys with the keys from
@cdevroe
cdevroe / filter-hubbub-disable-save-this-email.php
Created April 28, 2026 10:47
Disable Hubbub Save This from sending email
<?php
/**
* Disable the Hubbub "Save This" recipe email.
* Subscribers are still added to the connected Kit form/group, so the Kit
* welcome sequence (and Kit's double opt-in, if enabled) will run normally.
*
* Add via Code Snippets, WPCode, or a child theme's functions.php.
*/
add_filter( 'wp_mail', function( $args ) {
@cdevroe
cdevroe / wordpress-mcp-tester.php
Created May 11, 2026 13:48
WordPress MCP Endpoint Tester
<?php
/**
* WordPress MCP Endpoint Tester
*
* Tests whether a WordPress site's MCP endpoint is reachable or blocked
* by Cloudflare / a WAF / other firewall. If credentials are provided,
* additionally performs a read-only health check (MCP initialize handshake).
*
* Usage:
* php mcp-endpoint-test.php <url> [username] [app_password]