WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#43184 closed enhancement (worksforme)

WP REST API: Filter page / post lists based on permalink

Reported by: miztroh Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords:
Focuses: Cc:
PR Number:

Description

With the REST API, is it possible to query for pages / posts and filter by permalink? Something along the lines of /wp-json/wp/v2/posts?filter[permalink]=/2015/11/29/hello-world/.

See the previous discussion at https://github.com/WP-API/WP-API/issues/1776.

I'm reposting this here because the repo says the following:

"The WP REST API has been merged into WordPress core. Please do not create issues or send pull requests. Submit support requests to the forums or patches to Trac (see README below for links)."

I think this could be a really great feature and I don't want the request to get lost in a sea of Github issues that no one is checking.

Thank you!

Change History (1)

#1 @johnbillion
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
  • Version changed from trunk to 4.7

Yep! There's a slug parameter that you can use. It doesn't accept the full permalink, just the slug of the post which in your example is hello-world.

Docs here: https://developer.wordpress.org/rest-api/reference/posts/

Note: See TracTickets for help on using tickets.