Support » Plugin: WP REST API (WP API) » Filter parameter

  • Resolved thonyfd


    [Moderator note: Topic title de-capped. Please do not shout at us.]

    Hi all, i have a few days trying to use the filter parameter, but i don’t have idea how to send the filter information.

    Do you have an example or most detailed documentation for this functionality?

    Your plugin is great! but i have short rest experience.

    Best regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Guys,sorry for the title.

    About my problem i added this lines in “class-wp-json-posts.php”

    if(isset($filter) && $filter !==”){
    $filter = json_decode(stripslashes($filter),true);

    and i’m using an angularjs ajax method like this

    var filter = {};
    filter[‘posts_per_page’] = 5;
    filter[‘post_type’] = ‘Post’;
    filter[‘cat’] = 5;

    $http.get(‘http://myhost/wp-json.php/posts’, {params: {“filter”: JSON.stringify(filter)}}).success(function(data) {
    //something here

    this it solve my problem but, is there a better way to use the filter parameter ?

    thank’s for all, and sorry again .

    I find my answer in this post jeje

    Best Regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter parameter’ is closed to new replies.