bueltge/wp-rest-api-filter-items
Composer 安装命令:
composer require bueltge/wp-rest-api-filter-items
包简介
Removing Content From WP API Response on your request.
README 文档
README
A WordPress plugin to filters WordPress REST API items for your request. Its removing key and values from WP API response on your request.
Description
Per default, a post via WordPress REST API would fetch all data in wp-json/wp/v2/posts. For many reasons, you might want to exclude certain fields from WP API response in certain circumstances. This plugin enables you to filter your request for fields you require. Add items to the GET attribute on the url, like wp-json/wp/v2/posts?items=id,title,content in order to get only according field values.
The plugin currently supports the filtering of post, taxonomy and comments.
WP-API Versions
- Use the branch
wp-api-v1if you use WP-API Version 1. - The
masterbranch is for development, currently ready and open for feature requests for the WP API Version 2.
Installation
Install static via download, clone the repository or use dependency management via Composer
composer require bueltge/wp-rest-api-filter-items
Examples
Result for post: wp-json/wp/v2/posts?_wp_json_nonce=4355d0c4b3&items=id,title,content
[
{
"id": 1,
"title": {
"rendered": "Hello world!"
},
"content": {
"rendered": "<p>Welcome to <a href=\"http://localhost/wpbeta/\">WP Beta Dev Sites</a>. This is your first post. Edit or delete it, then start blogging!</p>\n"
}
}
]
Result for taxonomy: p-json/wp/v2/taxonomies/category?_wp_json_nonce=4355d0c4b3&items=name,slug,types.
{
"name": "Categories",
"slug": "category",
"types": [
"post",
"archiv"
]
}
Result for comments: wp-json/wp/v2/comments?items=id,author_name
[
{
"id": 1,
"author_name": "Mr WordPress"
},
{
"id": 2,
"author_name": "admin"
}
]
Requirements
- PHP 5.4
- WordPress 4.*
- WP REST API
Kudos
Thanks @dnaber-de for his modular, extendable PHP autoloader.
bueltge/wp-rest-api-filter-items 适用场景与选型建议
bueltge/wp-rest-api-filter-items 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36 次下载、GitHub Stars 达 64, 最近一次更新时间为 2016 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bueltge/wp-rest-api-filter-items 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bueltge/wp-rest-api-filter-items 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 64
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2016-06-03