pantheon-systems/pantheon-mu-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pantheon-systems/pantheon-mu-plugin

Composer 安装命令:

composer require pantheon-systems/pantheon-mu-plugin

包简介

Pantheon mu-plugin for WordPress sites.

README 文档

README

Actively Maintained Test GitHub Release GitHub License

The Pantheon Must-Use Plugin has been designed to tailor the WordPress CMS experience for Pantheon's platform.

What does that mean? We're glad you asked!

Features

WebOps Workflow

Integrates WordPress with Pantheon Worklow. Encourages updating plugins and themes in the Development environment and using Pantheon's git-based upstream core updates. Alerts admins if an update is available but disables automatic updates (so those updates can be applied via the upstream).

Login

Customized login form. The login page links back to the Pantheon dashboard on dev, test and live environments that do not have a domain attached.

Edge Cache (Global CDN)

Facilitates communication between Pantheon's Edge Cache layer and WordPress. It allows you to set the default cache age, clear individual pages on demand, and it will automatically clear relevant urls when the site is updated. Authored by Matthew Boynes.

WordPress Multisite Support

Simplified multisite configuration. The WP_ALLOW_MULTISITE is automatically defined on WordPress Multisite-based upstreams. The Network Setup pages and notices have been customized for a Pantheon-specific WordPress multisite experience.

Maintenance Mode

Put your site into a maintenance mode. Prevent users from accessing your sites during major updates by enabling Maintenance Mode either in the WordPress admin or via WP-CLI.

Compatibility Layer

Ensure your WordPress website is compatible with Pantheon. Automatically apply & report status of compatibility fixes for common issues that arise when running WordPress on Pantheon.

Hooks

The Pantheon Must-Use Plugin provides the following hooks that can be used in your code:

Filters

pantheon_wp_login_text

Filter the text displayed on the login page next to the Return to Pantheon button.

Default Value: Log into your WordPress Site

Example:

add_filter( 'pantheon_wp_login_text', function() {
	return 'Log into MySite.';
} );

pantheon_cache_default_max_age

Filter the default cache max-age for the Pantheon Edge Cache.

Default Value: WEEK_IN_SECONDS (604800)

Example:

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

pantheon_cache_do_maintenance_mode

Allows you to modify the maintenance mode behavior with more advanced conditionals.

Default Value: Boolean, depending on whether maintenance mode is enabled, user is not on the login page and the action is not happening in 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

Allows you to disable the ability to clear the entire cache from the WordPress admin. If set to false, this removes the "Clear Site Cache" section of the Pantheon Page Cache admin page.

Default Value: true

Example:

add_filter( 'pantheon_cache_allow_clear_all', '__return_false' );

pantheon_elasticpress_force_https_in_cli

Filter whether to force HTTPS for home and siteurl options during ElasticPress WP-CLI commands. When running wp elasticpress sync via Terminus, WordPress may fall back to http:// URLs from the database, causing ElasticPress to index content with incorrect URLs. This filter is enabled by default.

Default Value: true

Example:

add_filter( 'pantheon_elasticpress_force_https_in_cli', '__return_false' );

pantheon_skip_cache_control

Allows you to disable the cache control headers that are sent by the Pantheon Page Cache plugin.

Default Value: false

Example:

add_filter( 'pantheon_skip_cache_control', '__return_true' );

pantheon_compatibility_known_issues_plugins

Allows you to filter plugins with known compatibility issues on Pantheon so they are excluded from the Site Health check.

Default Value: An array of plugins with known issues, e.g.:

[
	'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/wordpress-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/wordpress-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/wordpress-known-issues#wordfence'
			)
		),
	],
]

Example:

// 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_show_update_notice

Filter whether the Pantheon WordPress core update notice is shown in the admin. Return false to hide it. This suppresses the "A new WordPress update is available!" / "Check for Updates" notices.

The notice also renders with id="pantheon-update-notice" and a matching pantheon-update-notice class, so it can be hidden with targeted CSS (e.g. #pantheon-update-notice { display: none; }) without affecting other Pantheon notices.

Default Value: true

Example:

add_filter( 'pantheon_show_update_notice', '__return_false' );

Actions

pantheon_cache_settings_page_top

Runs at the top of the Pantheon Page Cache settings page.

Example:

add_action( 'pantheon_cache_settings_page_top', function() {
	echo '<h2>My Custom Heading</h2>';
} );

pantheon_cache_settings_page_bottom

Runs at the bottom of the Pantheon Page Cache settings page.

Example:

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

Constants

PANTHEON_SHOW_UPDATE_NOTICE

Define as false (e.g. in wp-config.php) to hide the Pantheon WordPress core update notice. This is the constant equivalent of returning false from the pantheon_show_update_notice filter. Defaults to shown.

Note: this only hides the notice. It does not change update behavior. To opt out of Pantheon's update management entirely, use the separate DISABLE_PANTHEON_UPDATE_NOTICES constant.

Example:

define( 'PANTHEON_SHOW_UPDATE_NOTICE', false );

Install With Composer

Built for Composer. While Pantheon automation ensures that the latest version of the MU plugin are pushed with every update to WordPress, the Composer-based project ensures that you can manage it alongside your other WordPress mu-plugins, plugins and themes in your composer.json.

composer require pantheon-systems/pantheon-mu-plugin

-- Maintained by Pantheon and built by the community.

Releases and Changelogs

pantheon-systems/pantheon-mu-plugin 适用场景与选型建议

pantheon-systems/pantheon-mu-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 906.47k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2022 年 06 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 pantheon-systems/pantheon-mu-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pantheon-systems/pantheon-mu-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 pantheon-systems/pantheon-mu-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 906.47k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 16
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 11
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-16