Skip to content

Instantly share code, notes, and snippets.

add_action( 'af/form/submission', function ( $form, $args ) {
// Append a custom value to the submission array
AF()->submission['some_extra_data'] = 'some value here';
}, 10, 2 );
mishterk /
Last active December 10, 2023 21:39
This script replaces Breakdance's GSAP script URLs using a data URI scheme with a base64 encoded empty string which represents an empty JS file. This effectively removes Breakdance's copy of GSAP allowing third parties like to load their version of it without conflict.

Disable Breakdance GSAP assets

This can be used to disable the GSAP scripts in Breakdance when something like needs to be used instead. and Breakdance both load the same scripts with different versions and this causes's scrollTrigger feature to fail. I found this when using a Breakdance popup with animations on entry and exit.

This snippet comes with no support or guarantee so use at your own risk. If you do use it, feel free to comment below with any findings for others to consider.


add_action( 'af/field_group/before_field_group', function ( $field_group, $form, $args ) {
if ( $form['key'] !== 'form_64c0bb30bd954' ) {
echo '<div class="my-field-group-wrapper">';
mishterk /
Last active July 14, 2023 03:12
How to remove Git tracking for third party plugins in WordPress. Snippets for the post in a new tab)
git commit -m "Stopped tracking third party plugins"

Limit number of checkable boxes

Here is a simple JavaScript code snippet that limits the number of checkboxes that can be checked at any one time. In this example, the limit is set to 3 checkboxes.

This code creates a simple HTML page with 5 checkboxes. When a user tries to select more than the allowed number of checkboxes (in this case, 3), an alert will be displayed, and the latest checkbox selection will be undone.

add_filter( 'acf/load_field/key=TARGET_FIELD_KEY_HERE', 'afp_test_acf_load_field_filter' );
function afp_test_acf_load_field_filter( $field ) {
$field['choices'] = [];
// Using get_posts() instead of WP_Query prevents query loop issues and global var overrides that break
// functionality on the advanced forms edit screen and potentially other contexts.
$posts = get_posts( [
mishterk / acf-export-group_63799935b6476.json
Last active November 30, 2022 22:58
Testing multiple calculated fields in Advanced Forms Pro for ACF. These resources are for the video:
"key": "group_63799935b6476",
"title": "Calculated Fields",
"fields": [
"key": "field_637999367d114",
"label": "Number 1",
"name": "number_1",
"aria-label": "",
mishterk / load-images-from-production.php
Last active July 14, 2022 06:26
WordPress plugin for loading images from production on a staging/development website. See
* Plugin Name: Load Images From Production (for staging/dev)
* Description: Hooks into WP's media URL generation and replaces the domain with the production domain.
* Author: Phil Kurth
* Author URI:
// If this file is called directly, abort.
defined( 'WPINC' ) or die();
mishterk / replace-images-with-kittens.php
Last active July 14, 2022 04:25
Replace all attachment images with kitten placeholders...
add_filter( 'wp_get_attachment_image_src', function ( $image ) {
$image[0] = "$image[1]/$image[2]";
return $image;
}, 10 );
$post_type = 'my_post_type';
// Register the columns.
add_filter( "manage_{$post_type}_posts_columns", function ( $defaults ) {
$defaults['custom-one'] = 'Custom One';
$defaults['custom-two'] = 'Custom Two';