alleyinteractive/internal-flags
Composer 安装命令:
composer require alleyinteractive/internal-flags
包简介
Use a hidden taxonomy to improve expensive queries.
README 文档
README
Creates a hidden taxonomy to improve expensive query performance by not relying on meta queries. Allows for 'flags' to be set/unset on posts easily and entirely hidden from the end-user.
Instructions
By default, the internal taxonomy will be added to all registered post types.
Common Use Cases
- Hiding from archives/searches
- Posts by an author (where author is stored as a meta normally)
- Showing/hiding sponsored posts
Usage
Setting a flag on a post
use Internal_Flags\set_flag; set_flag( 'hide-from-archives', $post_id );
Removing a flag on a post
use Internal_Flags\remove_flag; remove_flag( 'hide-from-archives', $post_id );
Checking if a flag is on a post
use Internal_Flags\has_flag; has_flag( 'hide-from-archives', $post_id ); // bool
Searching for posts with a flag
use Internal_Flags\get_flag_tax_query; $posts = new \WP_Query( [ // ... 'tax_query' => [ get_flag_tax_query( 'show-on-page' ) ], ], );
Searching for posts without a flag
Inverse of the above
use Internal_Flags\get_flag_tax_query; $posts = new \WP_Query( [ // ... 'tax_query' => [ get_flag_tax_query( 'hide-from-archives', false ) ], ], );
alleyinteractive/internal-flags 适用场景与选型建议
alleyinteractive/internal-flags 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 329.02k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2022 年 07 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alleyinteractive/internal-flags 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alleyinteractive/internal-flags 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 329.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2022-07-27