Feature Req: Getting Values from Query?
-
Once again, thank you so much for this plugin.
I have a little trick I did where I used a token for Meta Value to pull in a value from a shortcode, which grabs it from the URL. In my case, I’m grabbing the last piece of the URL like so:
function hexa_change_query_year_value( $query_args, $block_query, $inherited ) { if ( isset( $query_args['meta_query'] ) && ! empty( $query_args['meta_query'] ) ) { if ( $query_args['meta_query'][0]['value'] == 'url_year' ) { $query_args['meta_query'][0]['value'] = basename($_SERVER['REQUEST_URI']); } } return $query_args; } add_filter( 'aql_query_vars', 'hexa_change_query_year_value', 10, 3 );
And this does what I want, but has an unfortunate side effect. Since the value only comes in through functions.php, the token has no value in the admin page. That means the query is viewed as invalid, and I am unable to do things like edit the block layout while that is in there. So to edit my layout, I have to temporarily type a valid value into the field, make my edits, then put my token back in.
Can the ability to pull values out of a URL like I’m doing, as well as out of a query string be an integrated feature? I’m hoping if it’s native to the plug, and not a hacky aftermarket trick like I’m doing, the broken query/locked layout can be avoided.
- The topic ‘Feature Req: Getting Values from Query?’ is closed to new replies.