Title: Feature Req: Getting Values from Query?
Last modified: March 29, 2024

---

# Feature Req: Getting Values from Query?

 *  [nitrospectide](https://wordpress.org/support/users/nitrospectide/)
 * (@nitrospectide)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/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:
 *     ```wp-block-code
       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.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [nitrospectide](https://wordpress.org/support/users/nitrospectide/)
 * (@nitrospectide)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/feature-req-getting-values-from-query/#post-17540125)
 * DERP. Title of this should be Feature Req: Getting Values from URL?
 *  Plugin Author [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * (@welcher)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/feature-req-getting-values-from-query/#post-17710637)
 * Hmm. This is an interesting idea. It feels like it might be too specific of a
   use-case to add to the plugin but maybe there is broader tool that can be added
   here. Leave it with me to think on
 * Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Feature Req: Getting Values from Query?’ is closed to new replies.

 * ![](https://ps.w.org/advanced-query-loop/assets/icon-256x256.png?rev=3106826)
 * [Advanced Query Loop](https://wordpress.org/plugins/advanced-query-loop/)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-query-loop/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-query-loop/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-query-loop/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-query-loop/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/feature-req-getting-values-from-query/#post-17710637)
 * Status: not a support question