Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Taxonomies are handled as arrays instead of objects #10

Open
niemenmaa opened this issue Jun 27, 2018 · 0 comments
Open

Taxonomies are handled as arrays instead of objects #10

niemenmaa opened this issue Jun 27, 2018 · 0 comments

Comments

@niemenmaa
Copy link

Readme states that $raw_post->taxonomies shoud be An array of taxonomy objects.

In set_taxonomies function the $raw_post->taxonomies is casted as array. Note that it's the array of objects that are casted instead of the objects.

In validate_taxonomies function there is first check ! is_array( $taxonomies which it now always true. The error message "Error in the taxonomies. Taxonomies must be passed in an associative array." implies that each object should be checked but instead of object it should be an associative array.

After that there is foearch loop with check if $term['taxonomy'] is a registered taxonomy. Here the code fails if you have set the $raw_post->taxonomies as an array of taxonomy objects. Array of associative arrays works. That's not optimal though since the WP_Term need to be casted to array before it can be used.

So should $raw_post->taxonomies contain objects or associative arrays?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant