Support

Account

Home Forums General Issues Filter relationship field on taxonomy term page based on term Reply To: Filter relationship field on taxonomy term page based on term

  • Hi @timo

    For the tax_query, change your code to the following:

    function my_relationship_query( $args, $field, $post )
    {
        // increase the posts per page
        $args['posts_per_page'] = 10;
        $args['tax_query'] = array(
               array(
    	    'terms' => '30'
               )
        );
    
        return $args;
        
    }

    Check out this link for more information: https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

    For accessing the term object id dynamically, you could consider using get_queried_object() function. Here is the link to the documentation: https://codex.wordpress.org/Function_Reference/get_queried_object