<span class="resolved" aria-label="Resolved" title="Topic is resolved."></span>Custom argument not defined in ‘alm_query_args_{id}’ hook

[ad_1]

Replies: 2

I have the following shortcode,

[ajax_load_more
  id="products_list"
  ...
  custom_args="rating:5"
]

connected to the following filter in a code snippet.

add_filter(
  'alm_query_args_products_list',
  'alm_do_stuff', 10, 2
);

function alm_do_stuff( $args, $id ) {

  if ( isset( $args['rating'] ) )
  {
    // do stuff
  }

  return $args;
}

The value of $args['rating'] in the filter code should be 5, but it’s undefined.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer