send custom args in shortcode into function
-
Hello,
Thanks for the plugin that helps a lot.
And I’d like to know is it possible to get a custom args in shortcode and make it as a variable in the meta_query key in function?
I’d like to have my shortcode looks like this
[query slug="history" args="hyear=2024"]
My custom callback called qw_custom_meta_query_filter_callback
and the code is as below
function qw_custom_meta_query_filter_callback($args, $filter){
$args['meta_query'] = array(
array(
'key' => 'datetime',
'type' => 'CHAR',
'compare' => 'LIKE',
'value' => 2024
),
);
return $args;
}I don’t know how to replace the value into a variable
Hope someone would give me some advice!
- You must be logged in to reply to this topic.