pantheon-systems / pantheon-mu-plugin Goto Github PK
View Code? Open in Web Editor NEWPantheon's WordPress mu-plugin for all WordPress-based upstreams.
License: MIT License
Pantheon's WordPress mu-plugin for all WordPress-based upstreams.
License: MIT License
Was referred to submit a potential issue from Pantheon's Slack.
Issue already patched within the MU-Plugin at around https://github.com/pantheon-systems/WordPress/pull/337/files that does not appear to have been backported yet into https://github.com/pantheon-systems/pantheon-mu-plugin/blob/main/inc/pantheon-page-cache.php (at the latest/current hash) as of this note/issue?
So correct to file an issue, but in the wrong GitHub and the wrong issue! :) Need to backport the changes into the pantheon-systems/pantheon-mu-plugin/
repo. :)
(I listed ACF Pro because I know it has some integrations with Yoast SEO, but the problem does not occur when ACF Pro is active. Its only with this specific combination of plugins.)
We upgraded our "stack" in January with the following changes:
20.1
, but tested 19.1
and above in case it was Yoast 20.x).1.0.0
to the mu-plugin
Composer-based version (including the recommended 'loader' file).term
caching was "deprecated" and to use the CDN
. Unsure if related.Once all updates were applied, we noticed an issue where the "Add New " button "appears" non-functional. Appears is in quotes because the terms will (randomly) save to the custom taxonomy (though not actually be seen on the page).
Note: After initial cache clear, it sometimes "works right", but then will not for other pages and/or after a refresh.
Occurs both on a "Pantheon" configured Lando environment and/or any given Pantheon environment, including LIVE.
api-fetch-min.js
is pinged twice. Both times the "returned" content is listed as cached
under the Transferred tab. (If not, give a refresh and/or edit a different page.)Any of these solutions seems to "fix" the issue, though clearly none of them are valid solutions.
mu-plugins/
folder.define('WP_CACHE', FALSE);
Disable Cache
checkbox on the "Network" tab of FireFox tools.0
.Running wp cache flush
via the CLI also sometimes fixes the issue for a single pageload.
I attempted to add the term "Another Test". You can see in the screenshot both that the "Transferred" items are cached
and that the term "Another Test" is not present.
Please forgive creative term names. It kept working for a minute, then failing, due to code-changes. :D
Feel free to ping me via Pantheon Slack, if needed, to see two environments where this issue is occurring. ๐
Since these lines supposedly will help not putting the define( 'WP_ALLOW_MULTISITE', true );
in the wp-config because this plugin does it automatically
But still it gives this link under the Tools > Network setup
https://dev-example.pantheonsite.io/wp-admin/network.php
The correct admin page eg: https://dev-example.pantheonsite.io/wp-admin/tools.php?page=setup_network only appears after adding define( 'MULTISITE', true );
in the wp-config
This is a vanity test that doesn't actually test anything that is failing. It was added to test against #30 when the DISABLE_PANTHEON_UPDATE_NOTICES
constant is set to true
except that at the time the tests are run, it's set to false
and the pantheon-updates.php
file is loaded. Basically, all the pantheon-updates
tests should be inside a separate test group that is only run when the constant is false
and separated from other tests when the constant is true
. There are likely other constants that perform similar functions and would require similar grouping.
Copying over pantheon-systems/WordPress#198 to evaluate since that was initially proposed before the mu plugin was broken out from the upstream.
Fom @eabquinaโ
For a general use case where a customer wants to set a specific cache TTL for WP REST API endpoints, we add a specific field for the REST API TTL value
Alternatively, we can implement a custom plugin to set specific cache headers for these endpoints too, but that will be covered by another proposal or docs guide
The intention here is to avoid modifying wp-config.php to achieve this, and specifically for those who want to disable cache for
See pantheon-systems/WordPress@57ba357 for the specific diff that should be re-applied if we pursue this.
I'm currently running WordPress 6.2-RC2 and I'm seeing the following notice in my dashboard:
When I click the link to go to my dashboard, there is no update available. This is, of course, because the current stable version of WordPress is 6.1.1 but I'm testing the next stable version.
It appears the logic in _pantheon_is_wordpress_core_latest()
is incorrect here:
pantheon-mu-plugin/inc/pantheon-updates.php
Lines 41 to 42 in 60b5490
It should rather be something like the following:
return version_compare( strtok( $wp_version, '-' ), strtok( $latest_wp_version, '-' ), '<=' );
Namely, 6.2-RC1
should be considered greater than or equal to the current stable version, 6.1.1
.
Would it be neat if we can get the code linted with WPPHPCS
or possibly using existing GH actions in the marketplace like https://github.com/rtCamp/action-phpcs-code-review
or better yet https://packagist.org/packages/pantheon-systems/pantheon-wp-coding-standards
If a customer tries to add define( 'WP_ALLOW_MULTISITE', true );
in the wp-config but they are not using the wordpress_network
framework, it will still tell them to proceed and point to the doc.
It would be better to warn users that they are not using the correct upstream and framework
something like
So they can request one if they do not have that capability yet
We have DISABLE_PANTHEON_UPDATE_NOTICES
set to true on our sites so our users don't get confused. This morning all of our sites are showing the error:
[14-Feb-2024 15:03:09 UTC] PHP Fatal error: Uncaught Error: Call to undefined function _pantheon_get_current_wordpress_version() in /code/web/app/mu-plugins/pantheon-mu-plugin/pantheon.php:22
it looks like pantheon-updates.php
isn't included if DISABLE_PANTHEON_UPDATE_NOTICES
is set and that is where _pantheon_get_current_wordpress_version()
is defined.
Instead of having complicated wp-config which forces a specific subdomain on non live env which complicates the initial config specially if a user will be using custom domains on other envs
pantheon-mu-plugin/inc/network/includes-network.php
Lines 499 to 528 in a185eeb
if ( !empty( $_ENV['PANTHEON_ENVIRONMENT'] )) {
$site_name = $_ENV['PANTHEON_SITE_NAME'];
// Override $hostname value as needed.
switch ( $_ENV['PANTHEON_ENVIRONMENT'] ) {
case 'live':
$hostname = $_SERVER['HTTP_HOST'];
break;
case 'test':
$hostname = 'test-' . $site_name . '.pantheonsite.io';
break;
case 'dev':
$hostname = 'dev-' . $site_name . '.pantheonsite.io';
break;
case 'lando':
$hostname = $site_name . '.lndo.site';
break;
default:
$hostname = $_ENV['PANTHEON_ENVIRONMENT'] . '-' . $site_name . '.pantheonsite.io';
break;
}
} else {
// Override with a default hostname.
$hostname = 'dev-example.pantheonsite.io';
}
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', $hostname );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
Replace it with a simpler one that is proven that works on subfolder & subdomain setup that dynamically works on any subdomain
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST'] );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.