Category not being assigned properly
Author | Posts |
---|---|
May 23, 2013 at 10:09 pm 4095 | |
Hi, Frontend form for custom post type allowing users to select custom post type categories. Drop down list shows the categories correctly for that post type. However, the selected category does not save properly and a new one seems to be created with just a number. e.g. I selected category syncrude and 39 was created and saved with the post. Can you help please... | |
May 24, 2013 at 5:19 am 4099 | |
Hi ForestNation, I am having the exact same issue with a custom taxonomy on a custom post type. I can include the custom taxonomy successfully on the form, but then when it save it converts all terms to a #number. | |
May 24, 2013 at 9:55 am 4105 | |
The problem happens when the taxonomy is not hierarchical, so making it hierarchical will solve the problem. | |
May 24, 2013 at 1:28 pm 4146 | |
Thanks Tareq, this worked. | |
May 24, 2013 at 3:07 pm 4150 | |
I want my custom taxonomy to act like tags, though, not hierarchical… | |
May 24, 2013 at 10:57 pm 4170 | |
Take a look here. | |
May 24, 2013 at 11:46 pm 4175 | |
Thanks for the reply, Tareq. That is similar to what I’m looking for but not exactly the same. I want to have a non-hierarchical custom taxonomy and have them in checkboxes on the form, not text inputs. That way the customer has to check off which custom taxonomy terms apply. I can add this to the form, no problem. But the problem arises when the terms are saved and get converted into numbers. For now I have changed the custom taxonomy to be hierarchical as a way around this, but not sure if that will cause problems down the line. | |
May 25, 2013 at 10:17 am 4185 | |
So open up foreach ($tax as $value) { wp_set_post_terms( $post_id, $non_hierarchical, $taxonomy[‘name’] ); | |
May 25, 2013 at 9:41 pm 4206 | |
that seems to be working! thank you very much Tareq. we could mark this as resolved. (for anyone else, the filename in question is /class/frontend-form-post.php…) |