Skip to content

Instantly share code, notes, and snippets.

@dboutote
Last active June 14, 2022 16:47
Show Gist options
  • Select an option

  • Save dboutote/2f6cd014f8df60018abc3f3aedea934a to your computer and use it in GitHub Desktop.

Select an option

Save dboutote/2f6cd014f8df60018abc3f3aedea934a to your computer and use it in GitHub Desktop.

Revisions

  1. dboutote revised this gist Sep 22, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions rest-endpoints-filter.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    <?php
    add_action( 'rest_endpoints', function( $endpoints ){
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
  2. dboutote revised this gist Sep 22, 2017. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions rest-endpoints-filter.php
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,15 @@
    add_action( 'rest_endpoints', function( $endpoints ){
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
    if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
    $post_endpoint[ 'args' ][ 'type' ] = array(
    'description' => 'Post types',
    'type' => 'array',
    'required' => false,
    'default' => 'post'
    );
    }
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
    if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
    $post_endpoint[ 'args' ][ 'type' ] = array(
    'description' => 'Post types',
    'type' => 'array',
    'required' => false,
    'default' => 'post'
    );
    }
    }
    }
    }
    return $endpoints;
    return $endpoints;
    }, 15 );
  3. dboutote revised this gist Sep 22, 2017. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions rest-endpoints-filter.php
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,15 @@
    add_action( 'rest_endpoints', function( $endpoints ){
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
    if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
    $post_endpoint[ 'args' ][ 'type' ] = array(
    'description' => 'Post types',
    'type' => 'array',
    'required' => false,
    'default' => 'post'
    );
    }
    }
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
    if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
    $post_endpoint[ 'args' ][ 'type' ] = array(
    'description' => 'Post types',
    'type' => 'array',
    'required' => false,
    'default' => 'post'
    );
    }
    }
    return $endpoints;
    }
    return $endpoints;
    }, 15 );
  4. dboutote revised this gist Sep 22, 2017. 1 changed file with 13 additions and 13 deletions.
    26 changes: 13 additions & 13 deletions rest-endpoints-filter.php
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,15 @@
    add_action( 'rest_endpoints', function( $endpoints ){
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
    if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
    $post_endpoint[ 'args' ][ 'type' ] = array(
    'description' => 'Post types',
    'type' => 'array',
    'required' => false,
    'default' => 'post'
    );
    }
    }
    }
    return $endpoints;
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
    if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
    $post_endpoint[ 'args' ][ 'type' ] = array(
    'description' => 'Post types',
    'type' => 'array',
    'required' => false,
    'default' => 'post'
    );
    }
    }
    }
    return $endpoints;
    }, 15 );
  5. dboutote created this gist Sep 22, 2017.
    15 changes: 15 additions & 0 deletions rest-endpoints-filter.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    add_action( 'rest_endpoints', function( $endpoints ){
    if( isset( $endpoints[ '/wp/v2/posts' ] ) ){
    foreach( $endpoints[ '/wp/v2/posts' ] as &$post_endpoint ){
    if( ! empty( $post_endpoint[ 'methods' ] ) && 'GET' == $post_endpoint[ 'methods' ] ){
    $post_endpoint[ 'args' ][ 'type' ] = array(
    'description' => 'Post types',
    'type' => 'array',
    'required' => false,
    'default' => 'post'
    );
    }
    }
    }
    return $endpoints;
    }, 15 );