pantheon-systems/pantheon-mu-plugin

WordPress 网站的 Pantheon mu-plugin。

安装次数: 659,733

依赖关系: 1

建议者: 0

安全性: 0

星级: 8

关注者: 9

分支: 5

开放问题: 8

类型:wordpress-muplugin

1.5.1 2024-09-09 21:49 UTC

README

Actively Maintained Test GitHub Release GitHub License

“必须使用”的 Pantheon 插件旨在定制 Pantheon 平台上的 WordPress CMS 体验。

这意味着什么?我们很高兴您提出了这个问题!

功能

WebOps 工作流程

将 WordPress 与 Pantheon 工作流程集成。 鼓励在开发环境中更新插件和主题,并使用基于 git 的上游核心更新。如果可用,则向管理员发出更新警报,但禁用自动更新(以便通过上游应用这些更新)。

登录

自定义登录表单。 登录页面链接回未附加域的 dev、测试和实时环境中的 Pantheon 仪表板。

边缘缓存(全球 CDN)

促进 Pantheon 边缘缓存层与 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 边缘缓存的默认最大缓存期。

默认值: WEEK_IN_SECONDS (604800)

示例

add_filter( 'pantheon_cache_default_max_age', function() {
    return 2 * WEEK_IN_SECONDS;
} );

pantheon_cache_do_maintenance_mode

允许您使用更高级的条件修改维护模式的行为。

默认值: 布尔值,取决于是否启用了维护模式,用户不在登录页面,并且操作不是在 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

位于潘多拉神庙页面缓存设置页面的底部。

示例

add_action( 'pantheon_cache_settings_page_bottom', function() {
	echo '<p>My Custom Footer</p>';
} );

使用Composer安装

专为Composer构建。虽然潘多拉自动化确保每次更新WordPress时都将MU插件的最新版本推送,但基于Composer的项目确保您可以与其他WordPress mu插件、插件和主题一起管理它,在您的composer.json文件中。

composer require pantheon-systems/pantheon-mu-plugin

潘多拉维护并由社区构建。

发布和变更日志