#2566 - Ability To Create Custom Geocoded Location Fields#2917
#2566 - Ability To Create Custom Geocoded Location Fields#2917kodinkat wants to merge 2 commits intoDiscipleTools:developfrom
Conversation
kodinkat
commented
Apr 29, 2026
- fixes: Ability to create custom geocoded location fields. #2566
---
---
---
---
- Added 'location' and 'location_meta' field types to admin settings and custom fields, allowing for user-creatable options. - Updated JavaScript settings to include new field types in dropdowns. - Improved location grid meta functions to support custom post meta keys for better flexibility in data management. - Enhanced activity logging to display field labels correctly when adding or removing locations, improving user feedback.
Code ReviewHighSilent data corruption in Files: The PR introduces a new early-return path in // new code added by PR
if ( \! in_array( (int) $grid_meta_id, $ids, true ) ) {
add_post_meta( $post_id, $location_meta_post_key, $grid_meta_id );
}
return $grid_meta_id;This means that if a post has London in the built-in When the user later removes London from Location_Grid_Meta::delete_location_grid_meta( $post_id, 'grid_meta_id', 5, $existing_post, 'my_address' );Inside that function (as updated by the PR): $wpdb->delete( $wpdb->dt_location_grid_meta, [ 'grid_meta_id' => 5 ] ); // shared row deleted
delete_post_meta( $post_id, 'location_grid_meta', 5 ); // built-in field pointer removed\!
delete_post_meta( $post_id, 'my_address', 5 ); // correctLondon disappears from the built-in Two changes are needed in the
Medium
The new private helper correctly prevents orphaning during Overall: The feature intent is sound and the |
- Updated the delete_location_grid_meta method to include an optional parameter for location_meta_field_settings, allowing for better handling of shared dt rows. - Improved the logic to unlink fields and delete metadata only when necessary, enhancing performance and preventing unintended data loss. - Adjusted calls to delete_location_grid_meta throughout the codebase to accommodate the new parameter, ensuring consistent behavior across the application.
Code Review
Medium1. Activity-message translation strings change their msgid, orphaning existing translations
The PR replaces: with: Because gettext uses the msgid (the first argument to If these strings appear in the official 2.
When delete_post_meta( $post_id, 'location_grid_meta', $grid_meta_id );If a future caller passes a custom field key ( Suggested fix: guard the final SummaryThe core architecture of sharing a single |
|
@corsacca review ready.... |