pantheon-systems / pantheon-wp-main
Requires
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-23 21:16:30 UTC
README
Pantheon 必用插件已被设计用于定制 WordPress CMS 在 Pantheon 平台上的体验。
这意味着什么?我们很高兴你问了!
功能
WebOps 工作流程
将 WordPress 与 Pantheon Worklow 集成。 鼓励在开发环境中更新插件和主题,并使用基于 git 的 Pantheon 核心更新。如果可用,则提醒管理员更新,但禁用自动更新(以便通过上游应用这些更新)。
登录
自定义登录表单。 登录页面链接回未附加域的 dev、test 和 live 环境的 Pantheon 仪表板。
Edge Cache(全球 CDN)
促进 Pantheon Edge Cache 层与 WordPress 之间的通信。 允许您设置默认缓存年龄,按需清除单个页面,并在网站更新时自动清除相关 URL。由 Matthew Boynes 编写。
WordPress 多站点支持
简化多站点配置。 在基于 WordPress 多站点的上游中自动定义 WP_ALLOW_MULTISITE
。已为 Pantheon 特定的 WordPress 多站点体验定制了网络设置页面和通知。
维护模式
将您的网站置于维护模式。 通过在 WordPress 管理员中启用维护模式或通过 WP-CLI,防止用户在主要更新期间访问您的网站。
兼容性层
确保您的 WordPress 网站与 Pantheon 兼容。 自动应用并报告常见问题的兼容性修复状态,这些问题是在 Pantheon 上运行 WordPress 时出现的。
钩子
Pantheon 必用插件提供了以下钩子,可以在您的代码中使用
过滤器
pantheon_wp_login_text
过滤登录页面旁边“返回 Pantheon”按钮显示的文本。
默认值: 登录您的 WordPress 网站
示例
add_filter( 'pantheon_wp_login_text', function() { return 'Log into MySite.'; } );
pantheon_cache_default_max_age
过滤 Pantheon Edge Cache 的默认缓存最大年龄。
默认值: WEEK_IN_SECONDS
(604800)
示例
add_filter( 'pantheon_cache_default_max_age', function() { return 2 * WEEK_IN_SECONDS; } );
pantheon_cache_do_maintenance_mode
允许您使用更复杂的条件来修改维护模式的行为。
默认值: Boolean,取决于是否启用了维护模式、用户不在登录页面,并且动作不在 WP-CLI 中发生。
add_filter( 'pantheon_cache_do_maintenance_mode', function( $do_maintenance_mode ) { if ( $some_conditional_logic ) { return false; } return $do_maintenance_mode; } );
pantheon_cache_allow_clear_all
允许您禁用从 WordPress 管理员清除整个缓存的能力。如果设置为 false
,则从 Pantheon 页面缓存管理员页面中删除“清除站点缓存”部分。
默认值: true
示例
add_filter( 'pantheon_cache_allow_clear_all', '__return_false' );
pantheon_skip_cache_control
允许您禁用 Pantheon 页面缓存插件发送的缓存控制头。
默认值: false
示例
add_filter( 'pantheon_skip_cache_control', '__return_true' );
pantheon_compatibility_known_issues_plugins
允许您过滤在 Pantheon 上存在已知兼容性问题的插件,以便在站点健康检查中排除。
默认值: 已知问题的插件数组,例如。
[ 'big-file-uploads' => [ 'plugin_status' => esc_html__( 'Manual Fix Required', 'pantheon' ), 'plugin_slug' => 'tuxedo-big-file-uploads/tuxedo_big_file_uploads.php', 'plugin_message' => wp_kses_post( sprintf( /* translators: %s: the link to relevant documentation. */ __( 'Read more about the issue <a href="%s" target="_blank">here</a>.', 'pantheon' ), 'https://docs.pantheon.io/plugins-known-issues#big-file-uploads' ) ), ], 'jetpack' => [ 'plugin_status' => esc_html__( 'Manual Fix Required', 'pantheon' ), 'plugin_slug' => 'jetpack/jetpack.php', 'plugin_message' => wp_kses_post( sprintf( /* translators: %s: the link to relevant documentation. */ __( 'Read more about the issue <a href="%s" target="_blank">here</a>.', 'pantheon' ), 'https://docs.pantheon.io/plugins-known-issues#jetpack' ) ), ], 'wordfence' => [ 'plugin_status' => esc_html__( 'Manual Fix Required', 'pantheon' ), 'plugin_slug' => 'wordfence/wordfence.php', 'plugin_message' => wp_kses_post( sprintf( /* translators: %s: the link to relevant documentation. */ __( 'Read more about the issue <a href="%s" target="_blank">here</a>.', 'pantheon' ), 'https://docs.pantheon.io/plugins-known-issues#wordfence' ) ), ], ]
示例
// Filter a specific plugin out of the known issues list. add_filter( 'pantheon_compatibility_known_issues_plugins', function( $plugins ) { if ( isset( $plugins['plugin-slug'] ) ) { unset( $plugins['plugin-slug'] ); } return $plugins; } );
动作
pantheon_cache_settings_page_top
在 Pantheon 页面缓存设置页面顶部运行。
示例
add_action( 'pantheon_cache_settings_page_top', function() { echo '<h2>My Custom Heading</h2>'; } );
pantheon_cache_settings_page_bottom
在 Pantheon 页面缓存设置页面底部运行。
示例
add_action( 'pantheon_cache_settings_page_bottom', function() { echo '<p>My Custom Footer</p>'; } );
使用 Composer 安装
专为Composer设计。虽然Pantheon自动化确保每次WordPress更新时都会推送最新的MU插件版本,但基于Composer的项目确保您可以在composer.json
中与其他WordPress mu插件、插件和主题一起管理它。
composer require pantheon-systems/pantheon-mu-plugin