bordoni / fakerpress

A WordPress plugin that implements an easy way to create fake data inside WordPress.
http://fakerpress.com
Other
338 stars 54 forks source link

How do I use Fakerpress with taxonomy fields? #138

Closed jmagill-platinumplatypus closed 3 years ago

jmagill-platinumplatypus commented 4 years ago

I have a custom post type Person with an ACF field Eye Color that is of type Taxonomy using a custom taxonomy that I created with CPT UI. Note that that taxonomy is set through the ACF field, not the typical Wordpress terms API. Save Terms is set to false so the terms are not saved to the post except through the field.

How do I get Fakerpress to populate this type of a field?

ginsterbusch commented 4 years ago

In theory, if the custom taxonomy is created with the base WP API, then there should be no issue in populating it. You'd probably populate them via the regular WP methods, because AFAIK the ACF part is just that: A specific setting for ACF / Meta Fields.

Of corpse, if this custom taxonomy of yours is completely unconnected to the specific CPT, it probably would fail (and also, that would NOT BE how you're supposed to use taxonomies).

The only other issue that could appear is mostly related with initialization of all the plugins involved - so eg. if Fakerpress gets initialized BEFORE CPT UI is, it might not "know" about the existence of the custom taxonomy (because it would not be registered in the system yet).

cu, w0lf.

jmagill-platinumplatypus commented 4 years ago

Thanks for the quick response. If I understand you correctly, then I should be using a Meta Field Rule with the type set to WP_Query. Is that correct?