Title: Adding Query Parameters
Last modified: March 20, 2023

---

# Adding Query Parameters

 *  [dbengston](https://wordpress.org/support/users/dbengston/)
 * (@dbengston)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/adding-query-parameters/)
 * I am looking to retrieve a subset of the records for a custom post type based
   on a value in an ACF field. The application is to allow our mobile app developer
   to call my site’s REST API for conference sessions, but only the ones with a 
   flag set.
 * Functionally, I’d like to just add the query param and value to the end of the
   url, like this:
   [https://www.immunology2023.org/wp-json/wp/v2/session?app_share=1](https://www.immunology2023.org/wp-json/wp/v2/session?app_share=1)
 * I’ve seen the WordPress documentation for doing this, but it includes the creation
   of a new REST endpoint, and I want to add this query param to an existing endpoint
   generated by the WP REST API Controller plugin.
 * Any advice? Code samples welcome!
 * Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fadding-query-parameters%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [dbengston](https://wordpress.org/support/users/dbengston/)
 * (@dbengston)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/adding-query-parameters/#post-16581157)
 * Referring to these threads:
 * [https://wordpress.org/support/topic/how-can-i-call-some-parameter/#post-14616864](https://wordpress.org/support/topic/how-can-i-call-some-parameter/#post-14616864)
 * [https://wordpress.org/support/topic/using-_fields-parameter-nullify-meta-keys/](https://wordpress.org/support/topic/using-_fields-parameter-nullify-meta-keys/)
 * I have drafted my own code snippet, to no avail. I should mention that the field
   app_share is from ACF, although I don’t think that should affect registering 
   it for query.
 *     ```wp-block-code
       add_action('rest_api_init', function(){
       	register_rest_field('session', 'app_share', array(
       		'get_callback' => function($params){
       			return \get_post_meta($params['id'], 'app_share', true);		
       		}
       	));
       });
       ```
   
    -  This reply was modified 3 years, 2 months ago by [dbengston](https://wordpress.org/support/users/dbengston/).

Viewing 1 replies (of 1 total)

The topic ‘Adding Query Parameters’ is closed to new replies.

 * ![](https://ps.w.org/wp-rest-api-controller/assets/icon-256x256.png?rev=2489942)
 * [WP REST API Controller](https://wordpress.org/plugins/wp-rest-api-controller/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-rest-api-controller/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-rest-api-controller/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-rest-api-controller/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-rest-api-controller/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-rest-api-controller/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [dbengston](https://wordpress.org/support/users/dbengston/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/adding-query-parameters/#post-16581157)
 * Status: not resolved