1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How can i retrieve a list of posts from my wordpress-rest api, with the sticke posts on top?

Discussão em 'Angular' iniciado por richard, Outubro 10, 2024.

  1. richard

    richard Guest

    When I want to get the posts from my Wordpress Rest API, the sticky posts are not at the top, but are sorted by date like the others.

    When I try to sort by sticky

    wp-json/wp/v2/posts?orderby=sticky


    I get this error message:

    code: "rest_invalid_param",
    message: "Invalid parameter(s): orderby",


    If I append the following parameters instead

    wp-json/wp/v2/posts?ignore_sticky_posts=0


    or

    wp-json/wp/v2/posts?ignore_sticky_posts=1


    the sorting does not change.

    How can I make the sticky posts always be at the top?

    Continue reading...

Compartilhe esta Página