Skip Navigation

[Resolved] Assigning Multiple Taxonomy Values to Multiple Select Boxes in Custom Post Type

This support ticket is created 4 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 reply, has 1 voice.

Last updated by andrewF-6 4 years, 11 months ago.

Author
Posts
#1407491

Tell us what you are trying to do?

I have this custom code that works perfectly in pulling in my "Media Type" custom taxonomy values into my "Media Type" select drop-down box:

<?php
/**
 * New custom code snippet (replace this with snippet description).
 */

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.

// Prepopulate Select Field with Custom Taxonomy Values
add_filter( 'wpt_field_options', 'add_some_options', 10, 3);
function add_some_options( $options, $title, $type )
{
    switch( $title )
    {
    case 'Media Type':
           $terms = get_terms( array(
// Custom Post Type Taxonomy Slug not the Name
'taxonomy' => 'media-type',
      'hide_empty' => false,
    ) );
        foreach( $terms as $term ) {
            $options[] = array(
                  '#value' => $term->term_id,
        '#title' => $term->name,
            );
        }
        break;
    }
    return $options;
}

I would like to be able to pull in Taxonomy Values from 3 other Custom Taxonomies into the same Custom Post Type. They are Column 1, Column 2, and Column 3. If I try to create the same code for each of the 3 other custom taxonomies it crashes my site because I believe the variables are being called / used by the "Media Type" drop down list and code snippet.

Is it possible to add additional Custom Taxonomy Values to Separate Select Drop Down Boxes within the same Custom Post type Entry page?

The website link is:
hidden link

Thank-you.

#1407501

My issue is resolved now. Thank you!

I resolved it by just creating a separate code snippet and renaming the function. It worked well.