- This topic has 2 replies, 2 voices, and was last updated 2 years, 8 months ago by
devr52.
-
AuthorPosts
-
-
May 23, 2019 at 3:40 pm #9389
devr52ParticipantWhen creating a piklist field for a custom taxonomy on a cpt,
I can set'scope' => 'post_meta'and provide a field name, and it will save the
id of the taxonomy term chosen to that custom meta field with the provided name.
This of course is not the same as using the built-in WP terms table, which allows the taxonomy to be edited in the admin page for the cpt normally.To correct this, I change the scope of the piklist field to
"taxonomy". Now it saves to the WP terms table, and the built-in WP mechanisms also work. However, what happens to'field'? If I remove it, it no longer works, but what is it doing with it?When the field is set as required and nothing is chosen, it doubles up the error message saying:
* <Label> is a required field
* <field name value> is a required fieldThis is ugly and broken.
-
May 23, 2019 at 9:16 pm #9390
SteveKeymasterThis is not broken. You just didn’t take the time to go through the code.
If you take a look in the Piklist Demos you would see that the when the scope is set to
taxonomy, we usepiklist_demo_typeas the field, because that is the taxonomy we want to save against.
https://github.com/piklist/piklist/blob/develop/add-ons/piklist-demos/parts/meta-boxes/field-taxonomies.php#L22-L23I also updated the docs to explain this:
https://piklist.github.io/docs/fields/field-parameters/#field -
May 28, 2019 at 1:30 pm #9396
devr52ParticipantThat is what my field is set to–the taxonomy type.
It still doubles up the error message, so that is still an issue–any ideas?
-
-
AuthorPosts
- You must be logged in to reply to this topic.