WP REST API - Custom Filters

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024

Комментарии • 38

  • @burner918
    @burner918 2 года назад +1

    Thank you so much for this. Been struggling with this for 2 days as a newbie and now thanks to this video I can filter my query through an API call for custom post types and meta values.

  • @pixelrangerstudio86
    @pixelrangerstudio86 3 года назад +2

    i am very very happy! that I found your channel! very informative, easy to understand and follow! saved me a lot of time, and gained a lot of knowledge! I really, cant thank you enough!

  • @trumpfbam2094
    @trumpfbam2094 4 года назад

    Especially in times of dropshipping, your video-content comes at the right time. thx and greetings from europe

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      Hmmm, really? What does Drop Shipping have to do with REST APIs. I mean I know they mostly use WP/WooCommerce for that, but do people really use REST API for something like that?

  • @zkr2133
    @zkr2133 3 года назад

    Thanks for this but how would you use it to filter a string e.g Gender?

  • @alexkey9372
    @alexkey9372 4 года назад

    hi there, excellent video! i was wondering, is there a very complex scenario to cover multiple filtering of products via rest api and acf group fields? e.g price range and brand selection and fabric selection and colour of product etc etc?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      Well this video is a basic example of that, it should be easy to extend it with additional fields/filters.

  • @pkg2885
    @pkg2885 4 года назад

    Thank you for the tutorial video. Your tutorial is very clear. Can you show how to display products based on user authentication?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      What do you mean?

    • @pkg2885
      @pkg2885 4 года назад

      In your tutorial product is a custom post-type... what do I have to implement if I only want logged in user to see this feed (list of products) and not see the list of products in the feed if the user is not login.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад +1

      @@pkg2885 You would have to set up some kind of authentication first. So that the users can log in from your app (maybe with JWT), then you would need to send users JWToken with every request so that you can only display the data for logged in users. This is not a trivial functionality and can't be explained in a RUclips comment. But I think this is a good overview of what you would have to do.

    • @pkg2885
      @pkg2885 4 года назад

      @@WatchandLearnTutorials Thank you. If you have any tutorial or courses regards this topic, I will sign up ^^
      I learnt iOS app development in swift and a develop Wordpress site, but I couldn't join the two together LOL
      Thank you for your overview ^^

  • @ΠΑΝΑΓΙΩΤΗΣΑΝΤΩΝΕΛΛΟΣ-ζ9φ

    Hello, nice video. Would it be possible to show a post method

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      Post method is usually used to add something to your API, or to delete or update a record. Check the episode after this one. I'm using POST there.

  • @chethiyaprasanga
    @chethiyaprasanga 4 года назад

    if you can make october cms based e commerce tutorial it will great help full.And thanks for your tutorials and stay safe.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад +1

      I'm thinking about it. A lot of people asked. Did you check October plugins, there are a few e-commerce plugins? I think the Shopaholic is the most popular.

    • @chethiyaprasanga
      @chethiyaprasanga 4 года назад +1

      @@WatchandLearnTutorials yep sure.thanks.their have created tutorial also.but it's not English language.so if you have time and .if you can create it will be really great thing for community.️any way thanks you again for your contents. stay safe you and your team.

  • @Tidino
    @Tidino 3 года назад

    Amazing! just keep on:)

  • @manuteaflorentin8856
    @manuteaflorentin8856 3 года назад

    Many thanks for your tutorial.
    Can you do a tuto with tax_query in request ?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      I probably won't be doing any more videos about WP REST API, you need to realise that this is just regular WordPress code and go from there. There is documentation about WP_Query so take a look at that, and I also have whole series about it. This is the video about tax_query spcificaly, but I suggest you watch the whole series: ruclips.net/video/Pbed29ZL4IY/видео.html and then you can use that to do pretty much anything with WP REST API.

  • @omeroz6133
    @omeroz6133 4 года назад

    Hi, If I am not mistaken, there was a video about node js in your channel. It still exists ? I cant find it now.

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      I don't think I made any videos about Node.js specifically. What else was the video about?

    • @omeroz6133
      @omeroz6133 4 года назад +1

      Oh It seems that I am confused. Nowadays I try to learn about the backend side of JavaScript so I watched many videos.
      Btw, your css grid tutorials were helpful for me. Thanks 👍

  • @Gigabyteserviceofficial
    @Gigabyteserviceofficial 3 года назад

    Please make the tutorial for CRUD over api with JWT token authentication by extending the built-in WP_REST_Controller class.

  • @theman7050
    @theman7050 3 года назад

    At 1:52, you passed $params into the callback function, but you never included it in the register rest endpoint function that executes this callback.
    How would this callback know where and what value this $params is coming from?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад +1

      These are parameters that you will receive from the request. You don't have to specify them when defining callback.

  • @Grishopping
    @Grishopping 4 года назад

    Hello, my English is very bad .... (I use google translator)
    Friend thank you very much for sharing your videos are excellent .... By the way this helps me for what I was looking to do ..
    suggestion is heard anyway
    I want to extract all the information that a plugin provides ... for example sensei in wordpres for an online academy ...
    I need to make an endpoint with the data that I want to show on the screen (videos, course, exam, etc.) I want to show this with react ..
    Some guidance is appreciated ... I even think it is a good proposal for your series hahaha
    I will be very pending of your answer ...
    Greetings from Venezuela
    Jose Grillo
    EN ESPAÑOL:
    Hola mi Ingles es muy malo .... (uso traductor de google)
    Amigo muchas gracias por compartir estan exelente tus videos .... Por cierto esto me sirve para lo que estaba buscando hacer..
    de todas formas se escuchan sugerencia
    Quiero extraer toda la informacion que suministra un plugin... por ejemplo sensei en wordpres para una academia online...
    necesito Hacer un endpoint con los datos que quiero mostrar en pantalla (videos, curso, examen, etc) esto lo quiero mostra con con react..
    Se te agradece algo de orientacion... hasta creo que es una buena propuesta para tu serie jajajaj
    Estare muy pendiente de tu respuesta...
    Saludos desde Venezuela
    Jose Grillo

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад +1

      Well, do you know how you would display the data from Sensei plugin in your theme? That is what you need to use on your endpoint. Also check if Sensei has REST API support. Because it may be already available, for example if you make a custom post type of: "products" you can get the data for it on wp-json/v2/products . This is the only advice I can give you because I have never used Sensei and don't know how it works.

    • @Grishopping
      @Grishopping 4 года назад

      @@WatchandLearnTutorials Translated with google translator
      Hello
      Watch and Learn thanks for responding.
      I tell you: I have NOT achieved
      Sensei support for REST API.
      I think I can do it, I just need to know or identify well the variables that this plugin uses and master a little more how to use the function: (embed) TO BRING THE LINKED INFORMATION and be able to use it through
      an endpoint ...
      I think there should be the route to follow ...
      Anyway, I invite you to analyze this proposal .....
      All the videos that I have seen are from endpoint is about code queries made by themselves ... it would be super like making an endpoint to consult the data made by a third party ... haha ​​I hope you understand me and it would be super if you did. ..
      anyway again thank you very much
      Greetings from Venezuela your friend Jose Grillo
      EN ESPAÑOL:
      Hola
      Watch and Learn gracias por responder.
      Te comento: NO he conseguido
      soporte de Sensei para API REST.
      Yo creo que lo puedo hacer, solo me falta saber o identificar bien las variables que usa ese plugin y dominar un poquito mas como utilizar la funcion: (embed) PARA TRAER LA INFORMACION VINCULADA y poderla usar traves de
      un endpoint....
      Creo que por ahi deberia ser la ruta a seguir....
      De todas formas te invito a que analices esta propuesta.....
      todo los videos que he visto es de endpoint es sobre consultas de codigo realizado por ellos mismos... seria super como hacer un endpoint para consultar los datos realizados por un tercero... jajaj espero me entiendas y seria super que lo hicieras....
      de todas formas nuevamente muchas gracias
      Saludos desde Venezuela tu amigo Jose Grillo

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад +1

      @@Grishopping I explain how to use ACF in this video on your endpoint. So I probably won't make a video you are suggesting. It seems to me that Sensei doesn't have the API to display its data on the custom endpoint. But I might be wrong.

    • @Grishopping
      @Grishopping 4 года назад

      @@WatchandLearnTutorials I understand you, I just want some generic tips how to identify variables, which would be the ideal wordpress commands to be able to scrutinize any third-party api ... without having to be talking about a specific one ...
      Ok, if you can, it would be super, I'm still investigating from Venezuela, greetings and thanks for responding

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  4 года назад

      @@Grishopping Generic tip is to read the documentation. For example in ACF: www.advancedcustomfields.com/resources/get_field/ so you should always look for some function or method that allows you to display the data in your theme. You can in 99% of cases use that method in your API endpoint. But if it doesn't have it in documentation, you can contact plugin author to see if there are some undocumented functions. That is all advice I can give you.

  • @nirvana7420
    @nirvana7420 3 года назад

    How to extend search functionality so that in wp rest api can pull all posts by author if we search by an author name? Currently only post title, post contents are being searched, but if we search by author name no results shown. Is there any way we can extend the default search functionality ?

    • @WatchandLearnTutorials
      @WatchandLearnTutorials  3 года назад

      AFAIK search in WP Query would search only for title (and maybe text?) developer.wordpress.org/reference/classes/wp_query/#search-parameters so you would need to create a query that will query the authors developer.wordpress.org/reference/classes/wp_query/#author-parameters .