Home Forums General Issues Create Custom Taxonomy Terms (as checkboxes), but create Checked?


Create Custom Taxonomy Terms (as checkboxes), but create Checked?

  • I can create Custom Taxonomy Terms from an array, which I use on Custom Post Types. I am creating the Custom Post Type post and then the Taxonomy Terms, taking data from a JSON API.

    My issue is that although the Taxonomy Terms are created, when I go to the Custom Post Type post to edit it, the Taxonomy Terms checkboxes are initially unchecked, and i have to manually tick them myself.

    Is there a way to add the Taxonomy Terms and add them checked/ticked at the same time?

    $game_tags = array(
    $term_taxonomy_ids = wp_set_object_terms( $games_slug, $game_tags, 'tags_list', true 
  • Do you have the load terms setting turned on for the taxonomy field?

  • Yes I have. When creating taxonomy terms using wp_set_object_terms are they meant to be created active/checked when they are made as default?

    I am wondering if it is my coding at fault.

  • You are creating terms and assigning the object to them in WordPress. This has nothing to do with the ACF field. However, if you have load terms turned on then ACF should be getting the terms from WP do decide what is set and not set.

    What is $games_slug. This should be the ID of the post that you’re setting the terms for.

  • Thank you for you help!

    It turns out that I was, as you suggested, using the variable $games_slug, which is the slug I set for the post, instead of the correct post ID I should have been using.

    It now works as it should!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Create Custom Taxonomy Terms (as checkboxes), but create Checked?’ is closed to new replies.