You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add customer meta deletion functionality with simple delete link (#160)
Complete implementation for deleting orphaned custom meta fields:
**Core functionality:**
- Add secure deletion endpoint with nonce verification in page_loaded() method
- Handle delete_meta_key parameter with proper sanitization
- Delete customer meta using wu_delete_customer_meta() function
- Clean redirect with success/error status and tab preservation
- Remove query parameters from URL to prevent reprocessing
**UI implementation:**
- Add 'Supprimer' link for orphaned fields (fields without form reference)
- Simple red text styling with text-decoration: none (no underline)
- Right-aligned positioning using float: right within small tag
- Matches existing 'Location:' text size and positioning
- Direct deletion on click - no confirmation for simplicity
**Security & behavior:**
- WordPress nonce verification prevents unauthorized deletions
- Only show delete option for orphaned fields (preserve form-linked fields)
- Secure parameter handling with sanitize_key() and sanitize_text_field()
- wp_safe_redirect() for secure page transitions
- Maintains all existing customer edit functionality
**Code approach:**
- Minimal implementation using simple href link with inline styles
- No JavaScript dependencies for maximum browser compatibility
- Clean separation of deletable vs non-deletable field logic
- Follows WordPress coding standards and security best practices
0 commit comments