Support

Account

Home Forums General Issues Taxonomy is not in sync between wordpress and ACF

Unread

Taxonomy is not in sync between wordpress and ACF

  • Hello,

    This is a bit complicated and Ill do my best to explain.

    1. I created a custom post type (Resources),
    2. For this custom post type I created taxonomies (Category , Population)
    3. The Custom Post type and Taxonomy were created by WCK – Custom Fields and Custom Post Types Creator
    4. I imported all resources and taxonomies into WordPress using WP All Import – ACF Add-On
    5. When I imported, I mapped the ACF taxonomy fields to use the ones created by WCK

    Everything appeared to work, all posts and custom fields were imported including the taxonomies

    Now that I have all the data in the system I will doing 2 things with it.

    1. I have a search page on public site which has drop down menus options using the taxonomies (uses a custom wp_query)
    2. I have a front end form for the public to submit new Resources (uses acf_form)
    3. When logged into admin and viewing resources, you will see the taxonomy are displayed in 2 separate places in the post editor, even though they are the same data. See screen shot below

    You will notice the taxonomies are not in sync.

    When searching in public search tool, it uses the taxonomy checkboxes on the right, but when submitting using the acf_form. it fills the taxonomy checkboxes on the left

    These are the exact same taxonomy, why are they not in sync?

    So these are my options (unless anyone can suggest a better one)
    1. Can I make them sync somehow?
    2. Can I make my search form use the data from the acf taxonomy on left instead of right?
    3. Can I make my acf_form populate the taxonomy on the right?

    Below screen shot is code for searching front end

    screen shot

    SEACRH PAGE DROP DOWN MENU

     <select name="population"> 
        <option value=""><?php echo pll__('Population'); ?></option> 
    
        <?php 
        
            $populations = get_categories( array(
    			'orderby' => 'cat_name',
    			'order'   => 'ASC',
    			'taxonomy' => 'resource_poplulation',
    			'hide_empty' => false
    		) );
    		
            foreach ($populations as $population) {
                $optionp .= '<option value="'.$population->slug.'">';
                $optionp .= $population->cat_name;
                //$option .= ' ('.$category->category_count.')';
                $optionp .= '</option>';
            }
            echo $optionp;
    		
    	
        ?>
    	</select>

    SEARCH RESULTS PAGE CUSTOM QUERY

    $this_pop = $_GET[‘population’];

    `$args = array (
    ‘post_type’ =>’resources’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => 100,
    ‘order’ => ‘ASC’,
    ‘s’ => $this_key
    );

    if (isset($this_pop) && ($this_pop != “”) ) {
    $args[‘tax_query’][] = array(‘taxonomy’ => ‘resource_poplulation’, ‘field’ => ‘slug’, ‘terms’ => $this_pop );
    }

    $wp_query = new WP_Query( $args );

Viewing 1 post (of 1 total)

The topic ‘Taxonomy is not in sync between wordpress and ACF’ is closed to new replies.