Support

Account

Home Forums General Issues relationship for taxonomy get current this taxonomy post

Unread

relationship for taxonomy get current this taxonomy post

  • Hi team,

    I have a post_type = project
    and a taxonomy for post_type = project_page
    – Now I create a relationship name = taxpage_order for taxonomy project_page

    how to: in project_page load current post_type = project of taxonomy

    my code get current: post of taxonomy: but not true

    
    function vnt_taxpage_order( $args, $field, $post_id ) {
        $queried_object = get_queried_object();
    
        if ( isset( $queried_object->taxonomy ) && $queried_object->taxonomy === 'project_page' ) {
            $term_id = $queried_object->term_id;
    
            $args['tax_query'] = array(
                array(
                    'taxonomy' => 'project_page',
                    'field'    => 'term_id',
                    'terms'    => $term_id,
                ),
            );
        }
    
        return $args;
    }
    add_filter( 'acf/fields/relationship/query/name=taxpage_order', 'vnt_taxpage_order', 10, 4 );
    

    Any idea for my case?
    Thanks team!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.