Title: New parameter feature request
Last modified: June 12, 2021

---

# New parameter feature request

 *  [teeboy4real](https://wordpress.org/support/users/teeboy4real/)
 * (@teeboy4real)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/new-parameter-feature-request/)
 * Hello,
 * Please can you add a new parameter to the [adverts_list] shortcode which is ability
   to exclude specific categories
 * E.g
 * exclude_category: – allows excluding specific ads categories from the advert 
   list
 * Thanks

Viewing 1 replies (of 1 total)

 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/new-parameter-feature-request/#post-14552540)
 * Hi,
    you can do that by adding the code below in your theme functions.php file
   or even better by creating a new blank plugin and pasting the below code there
 *     ```
       add_filter( 'shortcode_atts_adverts_list', 'my_adverts_list_category_exclude_atts', 10, 3 );
       function my_adverts_list_category_exclude_atts( $out, $pairs, $atts ) {
           if( ! isset( $atts["_category_exclude"] ) ) {
               $atts["_category_exclude"] = null;
           }
   
           $out["_category_exclude"] = $atts["_category_exclude"];
           return $out;
       }
       add_filter( "adverts_list_query", "my_adverts_list_category_exclude", 10, 2 );
       function my_adverts_list_category_exclude( $args, $params ) {
           if( isset( $params["_category_exclude"] ) ) {
               if( ! isset( $args["taxonomy"] ) || ! is_array( $args["taxonomy"] ) ) {
                   $args["tax_query"] = array();
               }
               $args["tax_query"][] = array(
                   'taxonomy' => 'advert_category',
                   'field'    => 'term_id',
                   'terms'    => $params["_category_exclude"],
                   'operator' => 'NOT IN',
       	    );
           }
           return $args;
       }
       ```
   
 * Once you do that you should be able to use the [adverts_list] as `[adverts_list
   _category_exclude="100"]` where 100 is the ID of the category you want to exclude.

Viewing 1 replies (of 1 total)

The topic ‘New parameter feature request’ is closed to new replies.

 * ![](https://ps.w.org/wpadverts/assets/icon-256x256.png?rev=2423472)
 * [WPAdverts - Classifieds Plugin](https://wordpress.org/plugins/wpadverts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpadverts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpadverts/)
 * [Active Topics](https://wordpress.org/support/plugin/wpadverts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpadverts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpadverts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * Last activity: [4 years, 12 months ago](https://wordpress.org/support/topic/new-parameter-feature-request/#post-14552540)
 * Status: not resolved