-
-
Notifications
You must be signed in to change notification settings - Fork 273
Description
Description
When updating bidirectional fields as described in the testing instructions, the relationship fields become inconsistent (i.e. the bidirectional pairs to do not point back to each other).
I have tracked this issue down to the wp_podsrel table not being populated with correct values for related_pod_id and related_field_id (they are populated with zero instead).
This in turn prevents the DELETE sql query inside the delete_relationships function from deleting both sides of the relationship at this line:
Line 8225 in ce61d8f
| DELETE FROM `@wp_podsrel` |
The reason the related_pod_id and related_field_id fields are being populated with zero can be tracked back to here:
Line 6394 in ce61d8f
| $related_pod_id = 0; |
The problem is that $related_data is empty, so the $related_pod_id and $related_field_id variables do not get updated. This problem can be tracked further back to the validate function in pick.php where this "related_data" is supposed to be created and inserted into the pods cache here:
Line 1863 in ce61d8f
| pods_static_cache_set( $options['name'] . '/' . $options['id'], $related_data, __CLASS__ . '/related_data' ); |
The issue here is that the $field variable is empty after this line:
Line 1759 in ce61d8f
| $field = pods_config_for_field( $options, $pod ); |
This is because the $options parameter is a Value_Field object rather than a Field object.
If I change the pods_config_for_field function (
Line 4873 in ce61d8f
| function pods_config_for_field( $field, $pod = null ) { |
Value_Field objects by adding the following lines:if( $field instanceof Value_Field) { return $field->get_field_object(); }then the bug seems to be fixed. However I'm not sure if this is the best way to address the problem or not?
Version
3.3.1
Testing Instructions
- Create two new pods (Custom Post Type), called "Pod A" and "Pod B"
- Create a single-select relationship field on "Pod A" called "b" which relates to "Pod B"
- Create a single-select relationship field on "Pod B" called "a" which relates to "Pod A", linked as a bidirectional relationship with the field created in step 2.
- Create two instances Pod A, named "A1" and "A2"
- Create one instance of Pod B, named "B1"
- Update the field "b" on post "A1" to point to "B1"
- Observe that the bidirectional field is updated correctly, i.e. the "a" field on "B1" now points to "A1" (however it can also be observed in the
wp_podsreltable that therelated_pod_idandrelated_field_idcolumns have a value of0, which causes a bug in the next step) - Update the field "b" on post "A2" to point to "B1"
Now the bidirectional fields are out of sync: the "a" field on "B1" points to "A1" instead of "A2".
The wp_podsrel table now has two entries for the "a" field on "B1", despite the fact that it is a single-select field.
Screenshots / Screencast
No response
Possible Workaround
If I change the pods_config_for_field function (
Line 4873 in ce61d8f
| function pods_config_for_field( $field, $pod = null ) { |
Value_Field objects by adding the following lines:if( $field instanceof Value_Field) { return $field->get_field_object(); }then the bug seems to be fixed. However I'm not sure if this is the best way to address the problem or not?
Site Health Information
`
### wp-core ###
version: 6.8.1
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: /%postname%/
https_status: false
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: local
user_count: 1
dotorg_communication: true
### wp-paths-sizes ###
wordpress_path: /Users/james/Local Sites/pods-issue/app/public
wordpress_size: 57.55 MB (60350020 bytes)
uploads_path: /Users/james/Local Sites/pods-issue/app/public/wp-content/uploads
uploads_size: 0.00 B (0 bytes)
themes_path: /Users/james/Local Sites/pods-issue/app/public/wp-content/themes
themes_size: 13.56 MB (14221466 bytes)
plugins_path: /Users/james/Local Sites/pods-issue/app/public/wp-content/plugins
plugins_size: 9.90 MB (10383172 bytes)
fonts_path: /Users/james/Local Sites/pods-issue/app/public/wp-content/uploads/fonts
fonts_size: directory not found
database_size: 3.19 MB (3342336 bytes)
total_size: 84.21 MB (88296994 bytes)
### wp-dropins (1) ###
db.php: true
### wp-active-theme ###
name: Twenty Twenty-Five (twentytwentyfive)
version: 1.2
author: the WordPress team
author_website: https://wordpress.org
parent_theme: none
theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, widgets-block-editor, block-templates, post-formats, editor-style
theme_path: /Users/james/Local Sites/pods-issue/app/public/wp-content/themes/twentytwentyfive
auto_update: Disabled
### wp-themes-inactive (2) ###
Twenty Twenty-Four: version: 1.3, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Three: version: 1.6, author: the WordPress team, Auto-updates disabled
### wp-plugins-active (2) ###
Pods - Custom Content Types and Fields: version: 3.3.1, author: Pods Framework Team, Auto-updates disabled
Query Monitor: version: 3.18.0, author: John Blackbourn, Auto-updates disabled
### wp-media ###
image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1809
imagemagick_version: ImageMagick 7.1.1-15 Q16 aarch64 98eceff6a:20230729 https://imagemagick.org
imagick_version: 3.7.0
file_uploads: 1
post_max_size: 1000M
upload_max_filesize: 300M
max_effective_size: 300 MB
max_file_uploads: 20
imagick_limits:
imagick::RESOURCETYPE_AREA: 64 GB
imagick::RESOURCETYPE_DISK: 9.2233720368548E+18
imagick::RESOURCETYPE_FILE: 786431
imagick::RESOURCETYPE_MAP: 32 GB
imagick::RESOURCETYPE_MEMORY: 16 GB
imagick::RESOURCETYPE_THREAD: 1
imagick::RESOURCETYPE_TIME: 9.2233720368548E+18
imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, ASHLAR, AVI, AVIF, AVS, BAYER, BAYERA, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUBE, CUR, CUT, DATA, DCM, DCR, DCRAW, DCX, DDS, DFONT, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, FTXT, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HEIC, HEIF, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, JXL, K25, KDC, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MPO, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORA, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, QOI, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, STRIMG, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, YAML, YCbCr, YCbCrA, YUV
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF
ghostscript_version: 10.04.0
### wp-server ###
server_architecture: Darwin 24.5.0 arm64
httpd_software: nginx/1.26.1
php_version: 8.2.27 64bit
php_sapi: fpm-fcgi
max_input_variables: 4000
time_limit: 1200
memory_limit: 256M
max_input_time: 600
upload_max_filesize: 300M
php_post_max_size: 1000M
curl_version: 8.7.1 (SecureTransport) LibreSSL/3.3.6
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: false
static_robotstxt_file: false
current: 2025-06-19T00:31:09+00:00
utc-time: Thursday, 19-Jun-25 00:31:09 UTC
server-time: 2025-06-19T00:31:06+00:00
### wp-database ###
extension: mysqli
server_version: 8.0.35
client_version: mysqlnd 8.2.27
max_allowed_packet: 16777216
max_connections: 151
### wp-constants ###
WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /Users/james/Local Sites/pods-issue/app/public/wp-content
WP_PLUGIN_DIR: /Users/james/Local Sites/pods-issue/app/public/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: local
WP_DEVELOPMENT_MODE: undefined
DB_CHARSET: utf8
DB_COLLATE: undefined
### wp-filesystem ###
wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
fonts: does not exist
### pods ###
pods-version: 3.3.1
pods-first-version: 3.3.1
pods-last-version: 3.3.1
pods-server-software: nginx/1.26.1
pods-user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:139.0) Gecko/20100101 Firefox/139.0
pods-session-save-path: undefined
pods-session-save-path-exists: No
pods-session-save-path-writable: No
pods-session-max-lifetime: 1440
pods-opcode-cache-apc: No
pods-opcode-cache-memcached: No
pods-opcode-cache-opcache: Yes
pods-opcode-cache-redis: No
pods-object-cache-apc: No
pods-object-cache-apcu: No
pods-object-cache-memcache: No
pods-object-cache-memcached: No
pods-object-cache-redis: No
pods-memory-current-usage: 7.257M / 40M
pods-memory-current-usage-real: 10.000M
pods-network-wide: No
pods-install-location: /wp-content/plugins/pods/
pods-developer: No
pods-tableless-mode: No
pods-relationship-table-enabled: Yes
pods-relationship-table-status: 5
pods-light-mode: No
pods-strict: No
pods-allow-deprecated: Yes
pods-api-cache: Yes
pods-shortcode-allow-evaluate-tags: No
pods-can-use-sessions: No
pods-settings-types_only: Enable [types_only=0]
pods-settings-watch_changed_fields: Disable [watch_changed_fields=0]
pods-settings-metadata_integration: Disable [metadata_integration=0]
pods-settings-metadata_override_get: Disable [metadata_override_get=0]
pods-settings-register_meta_integration: Disable [register_meta_integration=0]
pods-settings-media_modal_fields: Enable [media_modal_fields=0]
pods-settings-session_auto_start: Disable [session_auto_start=0]
pods-settings-dynamic_features_allow: Enable [dynamic_features_allow=1]
pods-settings-dynamic_features_enabled: Display and Form [dynamic_features_enabled=display,form]
pods-settings-show_access_restricted_messages: Disable [show_access_restricted_messages=0]
pods-settings-show_access_admin_notices: Enable [show_access_admin_notices=1]
pods-settings-dynamic_features_allow_sql_clauses: Disable [dynamic_features_allow_sql_clauses=0]
pods-settings-display_callbacks: Customized [display_callbacks=customized]
pods-settings-display_callbacks_allowed: esc_attr,esc_html
`