• Resolved cedmedia

    (@cedmedia)


    I have a relationship setup between a pod field and a corresponding CTP category/taxonomy. The form field populates the existing taxonomy entries correctly, but when I select/add a taxonomy value, it does not assign itself to the CTP.

    Is there a specific way this is suppose to be configured so my CTP can assign itself a category via the field?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Bernhard Gronau

    (@quasel)

    Hi,

    Unless I misunderstood your Question:
    Relationships to Taxonomies are possible but not recommended until you know exactly why you use it! For the most use cases it’s better to use the WordPress way -> edit pods -> advanced tab -> https://cl.ly/e676beea4f09

    I’m not sure what do you mean by assign itself? For a Relationship to work in Both way’s it needs to be configured as bi-directional on both ends!

    Hope that helps
    Bernhard

    Thread Starter cedmedia

    (@cedmedia)

    I created a custom taxonomy called Food Type. The associated Post Type is Restaurants.

    I have a custom post type called Restaurants. One of my fields is called Food Type and is a “Relationship” field type with “Related to” set to my “Food Type” taxonomy.

    The Bi-directional Field shows “no related fields found”.

    When I create my post, I select the Food Type value of my choosing and then click Publish.

    My expectation is that the Food Type will automatically assign itself to my post, but it does not. I have to manually do this after the fact using WordPress default taxonomy panel.

    Plugin Contributor Jim True

    (@jimtrue)

    Associated Taxonomy is the correct way to properly ‘assign’ those Taxonomy items to the posts. A relationship to a taxonomy is a completely different ‘relationship’ that does not enforce the associated connection. We don’t typically recommend people use Relationship fields to Taxonomy in addition to Associated Taxonomy (the proper WordPress Taxonomy connection) as that is primarily used for our Advanced Content Types to work with Custom Taxonomy. If you have a Custom Post Type, you just associate it naturally with the Custom Taxonomy by associating them together.

    If your intent is to override the way the ‘input’ looks for the Taxonomy, there are better ways of doing that. This particular code snippet can help you override the default Taxonomy display from WordPress for specific post-types and taxonomies: https://docs.pods.io/code-snippets/change-taxonomy-input-to-single-select/

    We do plan in the future to provide a ‘taxonomy display override’ but at present you can do it with the code above.

    Plugin Contributor Jim True

    (@jimtrue)

    You can also ‘update your taxonomy with the value of the fields selected in a relationship field to taxonomy’ using a post save action hook, referenced on our doc page for that:

    https://pods.io/docs/code/action-reference/pods_api_post_save_pod_item_podname/

    It’s the very first sample code below the reference docs.

    Thread Starter cedmedia

    (@cedmedia)

    Thanks Jim.

    Where does this Associated Taxonomy option/setting exist?

    “If you have a Custom Post Type, you just associate it naturally with the Custom Taxonomy by associating them together.” >> How exactly do you “associate it naturally”?

    I’ll check the action hook in the meantime.

    • This reply was modified 6 years, 3 months ago by cedmedia.
    • This reply was modified 6 years, 3 months ago by cedmedia.

    Hi @cedmedia,
    If I’m not mistaken, in Pods Admin, just edit your pod > Advanced Options > Select your taxonomy in “Built-in Taxonomies” at the bottom of the page. ??

    Plugin Contributor Bernhard Gronau

    (@quasel)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Assign category for CTP with Pod field’ is closed to new replies.