---
title: "How to Use Custom Query Filter to Create a Taxonomy List in WordPress?"
url: https://nexterwp.com/docs/use-custom-query-filter-to-create-a-taxonomy-list-in-wordpress/
date: 2024-11-29
modified: 2026-04-14
author: "Aditya Sharma"
description: "Are you looking to create a taxonomy list using a custom query filter in WordPress? Custom query filters can be used to create a taxonomy list, which is a way..."
image: https://nexterwp.com/wp-content/uploads/2024/11/How-to-Use-Custom-Query-Filter-to-Create-a-Taxonomy-List-in-WordPress_-1024x519.jpg
word_count: 301
---

# How to Use Custom Query Filter to Create a Taxonomy List in WordPress?

## Key Takeaways

- Nexter Blocks includes a Taxonomy Listing block that allows users to create a taxonomy list based on a custom query filter.
- Users can add custom code in their Child theme function.php file or use Nexter Extensions to add code snippets for advanced features.
- The example provided shows how to filter person IDs 73227, 970674, and 17293 using a custom query filter.

Are you looking to create a taxonomy list using a custom query filter in WordPress? Custom query filters can be used to create a taxonomy list, which is a way of organizing and categorizing content based on specific criteria.

With the Taxonomy Listing block from the Nexter Blocks, you can easily create a taxonomy list based on a custom query filter.

*To check the complete feature overview documentation of the Nexter Blocks Taxonomy Listing block,* [click here](https://nexterwp.com/docs/add-taxonomy-listing-in-wordpress/).

***Requirement  - This block is a part of the Nexter Blocks, make sure it's installed & activated to enjoy all its powers.***

[LIVE BLOCK LINK](https://nexterwp.com/nexter-blocks/builder/wordpress-taxonomy-listing/)

For instance, we want to create a taxonomy list showing person id.

For this, you have to add some custom code. You can add the code in your Child theme function.php file or you can use plugins like [Code Snippets](https://wordpress.org/plugins/code-snippets/) to add your custom code or if you are using the [Nexter](https://nexterwp.com/) theme you can use Nexter Extensions which comes with various extensions for your Theme including adding code snippets. 

> *Note: This feature is for advanced users only. If you are comfortable with PHP only, then you should use it.*

For example, we have added this code.

`add_filter(‘tpgb_custom_taxo_query’, ‘tpgb_custom_taxo_query_function’,10,1);

function tpgb_custom_doc_query_function( $query_args ){

$query_args[‘meta_query’] = array(

‘relation’ => ‘OR’,

array(

‘key’ => ‘person_id’,

‘value’ => 73227,

‘compare’ => ‘=’

),

array(

‘key’ => ‘person_id’,

‘value’ => 970674,

‘compare’ => ‘=’

),

array(

‘key’ => ‘person_id’,

‘value’ => 17293,

‘compare’ => ‘=’

)

)

return $query_args;

}`

Now to show the person ID based on this code, add the Taxonomy Listing block on the page, and select the appropriate style, layout, and taxonomy

Then go to the **Query** tab and in the **Custom Query ID** field, add the filter key i.e. *tpgb_custom_taxo_query* here. 

![](https://nexterwp.com/wp-content/uploads/2024/11/taxonomy-listing-custom-query-id-new.png)

Now it will list the person id’s.

## Frequently Asked Questions

**Q: What should I do if my custom query filter isn't working?**
A: If your custom query filter isn't working, double-check the code you've added to ensure it's correctly formatted. For example, ensure that the filter key matches the one used in your Taxonomy Listing block. Additionally, verify that the Taxonomy Listing block is installed and activated as part of the Nexter Blocks. If you're using a Child theme, ensure that the code is placed in the correct function.php file.

**Q: What are the best practices for adding custom code in WordPress?**
A: When adding custom code in WordPress, it's best to use a Child theme's function.php file or a plugin like Code Snippets. This approach keeps your customizations safe during theme updates. Additionally, ensure you have a backup of your site before making changes, as incorrect code can lead to errors. Using Nexter Extensions can also simplify this process, as it provides various tools for adding code snippets.

**Q: Does the Taxonomy Listing block support custom taxonomies?**
A: The Taxonomy Listing block can be used to display custom taxonomies in WordPress. By selecting the appropriate taxonomy in the block settings, you can effectively categorize and list your content based on custom criteria. This feature is particularly useful for organizing content in a way that aligns with your site's specific needs.
