roots/soil
最新稳定版本:4.1.1
Composer 安装命令:
composer require roots/soil
包简介
A WordPress plugin which contains a collection of modules to apply theme-agnostic front-end modifications
关键字:
README 文档
README
A WordPress plugin which contains a collection of modules to apply theme-agnostic front-end modifications.
Caution
This plugin is no longer maintained. Use Acorn Prettify instead.
Requirements
| Prerequisite | How to check | How to install |
|---|---|---|
| PHP >= 5.6.x | php -v |
php.net |
Installation
You can install this plugin via the command-line or the WordPress admin panel.
via Command-line
If you're using Composer to manage WordPress, add Soil to your project's dependencies.
composer require roots/soil
Then activate the plugin via wp-cli.
wp plugin activate soil
via WordPress Admin Panel
- Download the latest zip of this repo.
- In your WordPress admin panel, navigate to Plugins->Add New
- Click Upload Plugin
- Upload the zip file that you downloaded.
Modules
-
Cleaner WordPress markup
add_theme_support('soil', 'clean-up'); -
Disable REST API
add_theme_support('soil', 'disable-rest-api'); -
Disable asset versioning
add_theme_support('soil', 'disable-asset-versioning'); -
Disable trackbacks
add_theme_support('soil', 'disable-trackbacks'); -
Google Analytics
add_theme_support('soil', ['google-analytics' => 'UA-XXXXX-Y']); -
Move all JS to the footer
add_theme_support('soil', 'js-to-footer'); -
Cleaner walker for navigation menus
add_theme_support('soil', 'nav-walker'); -
Convert search results from
/?s=queryto/search/query/
add_theme_support('soil', 'nice-search'); -
Root relative URLs
add_theme_support('soil', 'relative-urls');
And in a format you can copy & paste into your theme:
/** * Enable features from Soil when plugin is activated * @link https://roots.io/plugins/soil/ */ add_theme_support('soil', [ 'clean-up', 'disable-rest-api', 'disable-asset-versioning', 'disable-trackbacks', 'google-analytics' => 'UA-XXXXX-Y', 'js-to-footer', 'nav-walker', 'nice-search', 'relative-urls' ]);
Module options
Soil 4 introduced support for options on some modules.
Full annotated list of features and options
/** * Enable features from Soil when plugin is activated * @link https://roots.io/plugins/soil/ */ add_theme_support('soil', [ /** * Clean up WordPress */ 'clean-up' => [ /** * Obscure and suppress WordPress information. */ 'wp_obscurity', /** * Disable WordPress emojis. */ 'disable_emojis', /** * Disable Gutenberg block library CSS. */ 'disable_gutenberg_block_css', /** * Disable extra RSS feeds. */ 'disable_extra_rss', /** * Disable recent comments CSS. */ 'disable_recent_comments_css', /** * Disable gallery CSS. */ 'disable_gallery_css', /** * Clean HTML5 markup. */ 'clean_html5_markup', ], /** * Disable WordPress REST API */ 'disable-rest-api', /** * Remove version query string from all styles and scripts */ 'disable-asset-versioning', /** * Disables trackbacks/pingbacks */ 'disable-trackbacks', /** * Google Analytics */ 'google-analytics' => [ /** * This is to go live with GA. * * This should probably be false in non-production. */ 'should_load' => false, /** * Google Analytics ID * * This is also known as your "property ID" or "measurement ID" * * Format: UA-XXXXX-Y */ 'google_analytics_id' => null, /** * Optimize container ID * * Format: OPT-A1B2CD (previously: GTM-A1B2CD) * * @link https://support.google.com/optimize/answer/6262084 */ 'optimize_id' => null, /** * Anonymize user IP addresses. * * This might be required depending on region. * * @link https://github.com/roots/soil/pull/206 */ 'anonymize_ip', ], /** * Moves all scripts to wp_footer action */ 'js-to-footer', /** * Cleaner walker for wp_nav_menu() */ 'nav-walker', /** * Redirects search results from /?s=query to /search/query/, converts %20 to + * * @link http://txfx.net/wordpress-plugins/nice-search/ */ 'nice-search', /** * Convert absolute URLs to relative URLs * * Inspired by {@link https://web.archive.org/web/20180529232418/http://www.456bereastreet.com/archive/201010/how_to_make_wordpress_urls_root_relative/} */ 'relative-urls', ]);
Contributing
Contributions are welcome from everyone. We have contributing guidelines to help you get started.
Community
Keep track of development and community news.
- Participate on the Roots Discourse
- Follow @rootswp on Twitter
- Read and subscribe to the Roots Blog
- Subscribe to the Roots Newsletter
- Listen to the Roots Radio podcast
roots/soil 适用场景与选型建议
roots/soil 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.81M 次下载、GitHub Stars 达 1.03k, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 roots/soil 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 roots/soil 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 roots/soil 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
Inertia.js server-side adapter for PHP. Handles full visits, Inertia XHR visits, asset-version 409 handshakes and partial reloads. Framework-agnostic, with transparent WordPress integration.
Adds Cache-Tag HTTP response headers for singular WordPress content and purges Cloudflare by tag when content changes.
AI Chatbot & Helpdesk Agent for WooCommerce. Connects your store to Egentify for AI-powered chat, order tracking, email, and ticketing.
MIDDAG's reference architecture for a WordPress plugin — composes the OSS framework/wordpress/ui libraries end to end.
Assets helper package for the Hybrid Core framework.
统计信息
- 总下载量: 1.81M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1043
- 点击次数: 42
- 依赖项目数: 20
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04