Two select fields problem

Support General Two select fields problem

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4278
    NamennajNamennaj
    Participant

    Hi guys,

    My page have two columns. On the left I want to show posts with 'Latest News' taxonomy selected. On the right I want to show 'Events'. Both work and they are pulling in data. However, when I save them. They switch to the same category (in the admin panel). I tried both select and select advanced and a mix of the two.

    Here is my code:

    
                array(
                    'id'   => 'latest_news_cat',
                    'name' => __( 'Latest News Category', 'latestnews' ),
    				'tab'  => 'latest_news_section',
                    'placeholder' => 'Select ...',
                    'type'  => 'taxonomy',
                    //'taxonomy'    => 'categories',
                    'field_type'  => 'select_advanced',
                    'query_args'  => array(),
                    'js_options'  => array( 'multiple' => false, ),
                    'multiple'    => false,
                ),
                array(
                    'id'   => 'events_cat',
                    'name' => __( 'Events Category', 'eventscategory' ),
    				'tab'  => 'latest_news_section',
                    'placeholder' => 'Select ...',
                    'type'  => 'taxonomy',
                    //'taxonomy'    => 'categories',
                    'field_type'  => 'select_advanced',
                    'query_args'  => array(),
                    'js_options'  => array( 'multiple' => false, ),
                    'multiple'    => false,
                ),
    #4279
    NamennajNamennaj
    Participant

    Just to add some more information. I just tried it with posts and I can have multiple post select fields. Just not Taxonomy select fields.

    #4292
    Anh TranAnh Tran
    Keymaster

    You shouldn't use 2 taxonomy fields with the same taxonomy, because taxonomy field sets the post terms, which makes 2 fields share the same value.

    You should use taxonomy_advanced instead. It works exactly the same as taxonomy, but doesn't set the post terms (and saves value as CSV in the post meta).

    #4309
    NamennajNamennaj
    Participant

    Thanks @rilwis. Tested and working.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Two select fields problem’ is closed to new replies.