Closed monecchi closed 8 years ago
Hi @monecchi. I can't see anything glaringly obvious. I'll have some time tomorrow afternoon to test this out using your example.
I'd expect $ingredients
to be an array of taxonomy term ID's. You'll then need to plug that ID, along with the taxonomy slug into get_term()
in order to grab the term name.
You could print_r()
the $ingredients
variable to see if you are indeed getting back an array of ID's?
Hey @mustardBees, thanks for the input! I've checked that out with print_r()
to see what I was getting, and the response is it returns nothing.
I've inspected the field on the WP Admin side with the chrome developer tool and noticed the [menu_item_ingredients][ ] is empty after saving, although it looks like options are in place as per the image bellow. Shouldn't [menu_item_ingredients][ ] be saving the selected options on it or am I confusing things here?
I'll debug my code and come back here for details.
What version of CMB2 are you running?
@mustardBees I'm using the 2.2.1 trunk version from the cmb2-rest-api branch.
@monecchi The field works against the current stable release (CMB2 2.2.1) from the WordPress Plugin repository.
I've tested against the cmb2-rest-api branch. Unfortunately I couldn't replicate the issue you've seen... mainly because I didn't get that far. There is a fair amount of active development going on. For me, the concat_items()
method has been moved, so the field is unable to generate the HTML options. It was moved in WebDevStudios/CMB2@1b3e251f8db429b3930e44ff43495838a9a39744.
I'm not sure what the plans are for this branch in terms of further breaking changes/time frames. It might be worth waiting on CMB2 to stabilize before working on an update.
Hey @mustardBees, thank you for your input and for the tests you've performed. I'll try to stick to the stable version again as this will save me from pulling my hair out. I'll wait for the WP Rest API support, which is still in the works, so as per your tests I might get it working with CMB2 stable version.
@monecchi Can you try again with version 3.0.1? I've tested against CMB2 2.2.2.1. Let me know if you have any further trouble.
I'm getting a hard time to retrieve the data from a pw_multiselect field for which the populated options come from a custom taxonomy terms. The issue I'm facing is that the pw_multiselect field lies within a repeatable group, and I'm not sure how to output it with along my current foreach loop logic.
The field is properly populated, and although it does not allow me to reorder, it is properly saving the data.
The repeatable group is set and working properly, I can grab the fields values as such:
I'm trying to check for the pw_multiselect field within the foreach loop as follows:
But if I try to output it like the following it returns nothing:
As long as the options are real taxonomy terms, do I have to use
get_the_term_list()
instead ofget_post_meta()
?Thanks in advance.