Turns out i had to add this to the functions.php file.
// MAKE API FILTERABLE
add_action( 'rest_api_init', 'post_meta_register' );
function post_meta_register() {
register_api_field( 'post',
'testing',
array(
'get_callback' => 'get_post_meta',
'update_callback' => null,
'schema' => null,
)
);
}
function get_post_meta( $object, $field_name, $request ) {
return get_post_meta( $object[ 'id' ], $field_name, true );
}
add_filter( 'rest_query_vars', 'allow_meta' );
function allow_meta( $valid_vars ) {
$valid_vars = array_merge( $valid_vars, array( 'meta_key', 'meta_value' ) );
return $valid_vars;
}