PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Filter to add custom taxonomy terms before post creation

  1. Ignore this post, didn"t check docs properly

    Hi

    We have a form that creates a new post with each submission. I would like to tag each post with a custom taxonomy term or terms based on which checkboxes within the form are checked.

    So say we have:

    checkbox 1
    checkbox 2
    checkbox 3
    checkbox 4

    and

    checkbox 5
    checkbox 6
    checkbox 7
    checkbox 8

    If any of checkboxes 1 - 4 are checked I would like to add termA to the post. If any of the checkboxes 5-8 are checked I would like to add termB. If say checkbox 3 and checkbox 7 are checked I would like to add both termA and TermB to the post.

    This doesn't seem like it should be to hard provided their is an existing filter to get hold of the form and its data and modify it before it creates the post + a reasonable tutorial on working with form data. Hopefully we can just get the values of the checkbox fields in a php script and use <?php wp_set_post_terms() ?> with a few if statements to apply the terms through the filter.

    Cheers

    Posted 10 years ago on Wednesday May 15, 2013 | Permalink