javascript WordPress查询多种帖子类型(REST API),对REST API的请求 - 查询多个帖子类型并按ACF字段对数据排序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript WordPress查询多种帖子类型(REST API),对REST API的请求 - 查询多个帖子类型并按ACF字段对数据排序相关的知识,希望对你有一定的参考价值。

'/wp/v2/multiple-post-type?&type[]=post&type[]=news&type[]=articles'
'/wp/v2/multiple-post-type?&type[]=post&type[]=news&per_page=100&orderby=date&order=asc'
'/wp/v2/multiple-post-type?&type[]=news&per_page=100&meta_key=post_likes&orderby=meta_value_num&order=desc'

//filter by fields
'/multiple-post-type?&type[]=news&fields=id,title.rendered,acf&per_page=100&meta_key=post_likes&orderby=meta_value_num&order=desc`

//get by slug
let singlePostPage = `${ProjectLinks.apiURL}/news/?slug=temporibus-voluptatem-sunt-doloribus`;

// etc


// About
// Want to get your site's posts, pages, articles, events?

// Use the Endpoint: 
'/wp-json/wp/v2/multiple-post-type'

// List:
// GET request to 
'/wp-json/wp/v2/multiple-post-type?&type[]=post&type[]=page'

// Get the page with slug "about-me":
// GET 
'/wp-json/wp/v2/multiple-post-type?slug=about-me&type[]=post&type[]=page'

// Search term "awesome":
// GET 
'/wp-json/wp/v2/multiple-post-type?search=awesome&type[]=post&type[]=page&type[]=articles'

以上是关于javascript WordPress查询多种帖子类型(REST API),对REST API的请求 - 查询多个帖子类型并按ACF字段对数据排序的主要内容,如果未能解决你的问题,请参考以下文章

wordpress如何设置多种支付方式

搜索多种内容类型

Wordpress:归档多种帖子类型

自动将 Wordpress 从多种语言翻译成英语

XuperChain 百度区块链简易学习帖

Wordpress - 用于多种帖子类型的分类法 - 如何仅为一个获取_terms / get_categories?