-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
taxonomy_select default being stomped by get_object_terms #572
Comments
Update: I noticed the ternary condition for $saved_term favors the $names failover because the result of $names is almost always going to return the terms the field is set to use. It's therefore nearly impossible a default setting would ever work for this, unless you added something like:
|
Any updates or progress made on this @wilrevehl ? |
Oh, I never made a fork contribution since I never heard back and the issue was small. I'm not really a GIT user as it is. Nothing has changed in CMB2 taxonomy_select. $names is still the sole ruler of the conditional. |
Closing early as Justin's commit above states it fixes this issue. |
Hi Justin, et all,
Thanks for much for your sharing hard work on CMB2. It's definitely the best out there, we applaud you.
I'm having an issue setting default on taxonomy_select. At the time of writing, line 665 of includes\CMB2_Types.php::$saved_term has a ternary with $this->get_object_terms() taking precedence over default. get_object_terms() gets the select by using something stored as a cmb-cache. This probably has its purpose. Unfortunately, I'm trying to use taxonomy_select with dynamic data from a callback to set the default. This is important because it allows the same form for New and Edit. That other cached value is causing the intended default (from data specific to the post) to be ignored.
I'm going to see if I can workaround this using the filters. My use may be an edge case, but thought you should know this feels like an unintended consequence. Thanks. Keep rocking.
The text was updated successfully, but these errors were encountered: