Title: bbabics's Replies | WordPress.org

---

# bbabics

  [  ](https://wordpress.org/support/users/bbabics/)

 *   [Profile](https://wordpress.org/support/users/bbabics/)
 *   [Topics Started](https://wordpress.org/support/users/bbabics/topics/)
 *   [Replies Created](https://wordpress.org/support/users/bbabics/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/bbabics/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/bbabics/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/bbabics/engagements/)
 *   [Favorites](https://wordpress.org/support/users/bbabics/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WordPress REST API (Version 2)] Get posts after a specific date](https://wordpress.org/support/topic/get-posts-after-a-specific-date/)
 *  [bbabics](https://wordpress.org/support/users/bbabics/)
 * (@bbabics)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/get-posts-after-a-specific-date/#post-8410812)
 * This is exactly what I’m looking to do using `Version 2.0-beta15` with a custom
   post type that inherits from the `WP_REST_Posts_Controller`, but sorts based 
   on an acf field. Unfortunately this isn’t working for me. 🙁
 * I’m hitting the following endpoint:
    `/wp-json/wp/v2/almanac_entry?per_page=3&
   filter[orderby]=acf_almanac_date&after=2016-12-23T00:00:00&filter[date_query[
   column]]=acf_almanac_date`
 * and it’s returning three results (should be two) where two are after the date
   listed, and the third is before the date listed.
 * Here’s how I’m registering my actions:
 *     ```
       add_action( 'init', 'register_custom_post_types', 25 );
       function register_custom_post_types() {
       	global $wp_post_types;
   
       	$post_type_name = 'almanac_entry';
       	if( isset( $wp_post_types[ $post_type_name ] ) ) {
       		$wp_post_types[$post_type_name]->show_in_rest = true;
       		$wp_post_types[$post_type_name]->rest_base = $post_type_name;
       		$wp_post_types[$post_type_name]->rest_controller_class = 'WP_REST_Posts_Controller';
       	}
       }
   
       add_action( 'rest_api_init', 'wp_rest_add_custom_fields' );
       function wp_rest_add_custom_fields() {
       	register_rest_field('almanac_entry', 'acf_almanac_date', array (
           'get_callback' => function($object, $field_name, $request) {
             return get_post_meta( $object[ 'id' ], 'almanac_date', true );
           },
           'update_callback' => null,
           'schema'          => null,
         ));
       }
       ```
   
 * I’m new to doing WP dev, so I may have done this wrong. I’m wondering if maybe
   it’s due to the priority not being set in `add_action`?
 * Any help is much appreciated.
    -  This reply was modified 9 years, 9 months ago by [bbabics](https://wordpress.org/support/users/bbabics/).
      Reason: trying to figure out how to format code in my post

Viewing 1 replies (of 1 total)