Title: Post query hook not working
Last modified: September 18, 2017

---

# Post query hook not working

 *  [robertcc18](https://wordpress.org/support/users/robertcc18/)
 * (@robertcc18)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/post-query-hook-not-working/)
 * Hi,
 * I am trying to use the alm_query_args_{id} filter, it does not seem to be running.
 * Here is my shortcode `[ajax_load_more id="led" container_type="div" post_type
   ="led_lighting" posts_per_page="12" pause="true" scroll="false" progress_bar="
   true" progress_bar_color="#D61F2" images_loaded="true" button_label="Load More"
   button_loading_label="Loading Products"]`
 * Here is my function
 *     ```
       function my_led_listing($args){
         $terms = $_GET['series'];
       if ( $terms ) {
           $args['tax_query'] = [
               [
                   'taxonomy' => 'led_lighting_category',
       			'field' => 'name',
                   'terms' => $terms,
               ]
           ];
       }
       // Append our tax-query if we have terms. Make sure it is a valid string or array
       $terms_2 = $_GET['prod_cat'];
       if ( $terms_2 ) {
           $args['tax_query'] = [
               [
                   'taxonomy' => 'led_product_category',
       			'field' => 'name',
                   'terms' => $terms_2,
               ]
           ];
       }
       // Append our tax-query if we have terms. Make sure it is a valid string or array
       $terms_3 = $_GET['watts'];
       if ( $terms_3 ) {
           $args['tax_query'] = [
               [
                   'taxonomy' => 'led_watts_category',
       			'field' => 'name',
                   'terms' => $terms_3,
               ]
           ];
       }
       // Append our tax-query if we have terms. Make sure it is a valid string or array
       $terms_4 = $_GET['efficacy'];
       if ( $terms_4 ) {
           $args['tax_query'] = [
               [
                   'taxonomy' => 'led_efficacy_category',
       			'field' => 'name',
                   'terms' => $terms_4,
               ]
           ];
       }
       // Append our tax-query if we have terms. Make sure it is a valid string or array
       $terms_5 = $_GET['color_temp'];
       if ( $terms_5 ) {
           $args['tax_query'] = [
               [
                   'taxonomy' => 'led_color_temp_category',
       			'field' => 'name',
                   'terms' => $terms_5,
               ]
           ];
       }
         return $args;
   
       }
       add_filter( 'alm_query_args_led', 'my_led_listing' );
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/post-query-hook-not-working/#post-9510015)
 * Hi ,
    The issue here is likely the reference to `$_GET`. `$_GET` will be null
   in the filter.
 * To get querystring values in the filter you need do something like the following:
 *     ```
       function my_led_listing($args){
          $querystring = $_SERVER['HTTP_REFERER'];
          parse_str($querystring, $output);
          //print_r($output);
       }
       add_filter( 'alm_query_args_led', 'my_led_listing' );
       ```
   
 * `$output` will provide you with a parse array of querystring values and you will
   need to further parse them from there.
 * Hope this helps somewhat.

Viewing 1 replies (of 1 total)

The topic ‘Post query hook not working’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/post-query-hook-not-working/#post-9510015)
 * Status: not resolved