Skip to content

Instantly share code, notes, and snippets.

@zackkatz
zackkatz / gk-disable-entry-creation.php
Last active February 27, 2026 21:01
GravityKit - Disable Entry Creation: Automatically delete a Gravity Forms entry and any associated files after submission. Enable per-form in Form Settings > Restrictions.
<?php
/**
* Plugin Name: GravityKit - Disable Entry Creation
* Plugin URI: https://www.gravitykit.com
* Description: Automatically delete a Gravity Forms entry and any associated files after the form is submitted. Enable per-form in Form Settings.
* Version: 1.0
* Author: GravityKit
* Author URI: https://www.gravitykit.com
* License: GPL-2.0+
* Requires Plugins: gravityforms
@zackkatz
zackkatz / gravityview-claim-entry-by-user-data.php
Last active February 17, 2026 02:13 — forked from bennemann/gravity-view-claim-entry-by-user-data.php
Modify whether the currently logged-in user can edit an entry that was not created by them
<?php
add_filter( 'gravityview/edit_entry/user_can_edit_entry', 'gv_claim_entry_by_user_data', 20, 3 );
/**
* Allow logged-in users to edit entries where their user data matches a field value in the entry.
*
* Supports multiple Views, each with its own field to check against the current user's display name.
*
* @see https://docs.gravitykit.com/article/520-allow-user-edit-field-match
@zackkatz
zackkatz / entry-slug-merge-tag.php
Last active November 6, 2025 22:20
GravityView - {entry_slug} Merge Tag
<?php
/**
* Add {entry_slug} Merge Tag for GravityView
*
* This snippet creates a custom merge tag that outputs the GravityView entry slug.
* The entry slug is used in GravityView URLs and can be customized via the
* 'gravityview/entry/slug' filter.
*/
/**
@zackkatz
zackkatz / gravitykit-modify-uploads-path.php
Created October 22, 2025 23:12
Update GravityKit logs path to be in the uploads folder
<?php
/**
* Modify GravityKit log path to use WordPress uploads directory.
*
* @param string $log_path Default log path.
* @return string Modified log path.
*/
add_filter( 'gk/foundation/logger/log-path', function( $log_path ) {
$upload_dir = wp_upload_dir();
@zackkatz
zackkatz / gv-update-acf-google-maps.php
Last active September 30, 2025 00:01
GravityView: Update ACF Google Maps fields on Edit Entry
<?php
/**
* Update ACF Google Maps field when editing entries via GravityView
*
* This snippet complements the GP Address Autocomplete ACF snippet:
* https://gravitywiz.com/snippet-library/gpaa-acf-google-maps/
*
* PROBLEM: The original GP snippet only runs when Advanced Post Creation initially
* creates a post. When you edit an entry through GravityView's Edit Entry feature,
* the ACF Google Maps field becomes empty because the snippet doesn't run again.
@zackkatz
zackkatz / edd-refund-column.php
Created August 11, 2025 19:51
EDD Refund Column - Adds a “Request Refund” column to the Easy Digital Downloads purchase history table
<?php
/**
* Plugin Name: EDD Refund Column
* Description: Adds a “Request Refund” column to the Easy Digital Downloads purchase history table that links to a refund page with the Order ID.
* Author: Your Name
* Version: 1.3.0
* Requires at least: 6.0
* Requires PHP: 7.4
* License: GPL-2.0-or-later
*
@zackkatz
zackkatz / add-radius-options-to-search.php
Created June 16, 2024 22:46
GravityView Maps - Add more radius search options
<?php
/**
* Add larger-radius options for geolocation radius search.
*
* @param array $options Nested array. `value` key maps to the size of the radius.
*
* @return array Modified array of options.
*/
add_filter( 'gk/gravitymaps/geolocation_radius_options', function ( $options ) {
@zackkatz
zackkatz / .php
Created December 11, 2023 19:49
GravityView - Always show the label by default
<?php
/**
* Always show the field label by default.
*
* @param array $field_options Default field options for each field in View Configuration screen.
*
* @return array
*/
add_filter( 'gravityview_template_field_options', function( $field_options ) {
@zackkatz
zackkatz / gravity-forms-cookie-merge-tag.php
Created December 7, 2023 20:17
Gravity Forms - Add a {cookie} Merge Tag
@zackkatz
zackkatz / add-event-source-to-calendar.php
Last active November 29, 2023 22:05
GravityCalendar - Add a sample event feed
<?php
/**
* Example of how to add a sample event source.
*
* @param array $sources The array of event sources. {
* @type string $url The URL of the event source.
* @type string $type The type of event source. Either `ics` or `json`.
* @type string $color The color of the event source.
* }