Dynamically Add Signup Location to Mailchimp Embedded Form

A situation came up a franchise site that is a WordPress multisite installation, where we wanted to dynamically populate the signup location property for segmentation, set with the website URL. Following these instructions doesn’t work for this situation, though it is close.  https://kb.mailchimp.com/lists/signup-forms/determine-webpage-signup-location. We also can’t do something like this (it didn’t seem to work): […]

Continue reading...

Using PHP Lambda Functions with WordPress add_action() and add_filter() Functions

I’m a fan of anonymous functions and reusable function definitions, like PHP lambda functions in JavaScript.  I’ve used anonymous functions in WordPress development where possible, so for example: add_filter(‘widget_text’, function($html) { if( strpos($html,'<?php’) !== false ) { ob_start(); eval(‘?>’ . $html); // Close the current PHP tag…the contents we’ll get will have <?php ?> tags […]

Continue reading...