alleyinteractive/archiveless
Composer 安装命令:
composer require alleyinteractive/archiveless
包简介
WordPress plugin to hide posts from archives (lists)
README 文档
README
Excludes specific WordPress posts from archives (homepage, search, date/author/term archives).
Adds <meta name='robots' content='noindex,nofollow' /> meta to the head to
restrict inclusion in web searches.
Background
This plugin provides a way for content to live inside WordPress and still be accessible by a direct URL but appear hidden everywhere else. Useful for culling older content that shouldn't appear in search results because it is untimely.
Usage
By default, the plugin will prevent archiveless posts from appearing on the page. This is limited to the main query of the page. It will not affect other queries by default.
Archiveless posts can be excluded from normal queries by passing
exclude_archiveless:
$query = new WP_Query( [ 'exclude_archiveless' => true, // ... ] ); // Via 'pre_get_posts'. add_action( 'pre_get_posts', function ( $query ) { if ( special_condition() ) { $query->set( 'exclude_archiveless', true ); } } );
Handling archiveless posts with get_posts() calls
Queries made with get_posts() will always exclude archiveless posts by default
since get_posts() sets a default post_status of publish. To include
archiveless posts, you can specify the post_status of any, declare the
post_status explicitly with [ 'publish', 'archiveless' ], or pass
include_archiveless set to true:
// $post_ids will include archiveless posts. $post_ids = get_posts( [ 'fields' => 'ids', 'include_archiveless' => true, 'suppress_filters' => false, ] ); // Or declare the post_status explicitly. $post_ids = get_posts( [ 'fields' => 'ids', 'suppress_filters' => false, 'post_status' => [ 'archiveless', 'publish' ], ] );
Install
The plugin includes uncompiled Javascript. You can install the plugin by
tracking the main-built branch or by using a *-built tag. Otherwise, you can
download the plugin and compile the assets manually:
npm install npm run build
Changelog
Please see CHANGELOG for more information on what has changed recently.
Maintainers
This project is actively maintained by Alley Interactive. Like what you see? Come work with us.
License
This software is released under the terms of the GNU General Public License version 2 or any later version.
alleyinteractive/archiveless 适用场景与选型建议
alleyinteractive/archiveless 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.38k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2022 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alleyinteractive/archiveless 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alleyinteractive/archiveless 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-08-02