I think this is right, good idea. However, it looks like there is an even simpler way. Reference: wp-cli/php/WP_CLI/Runner.php at d2a002214df900bba7303310f42c68b996d873ab · wp-cli/wp-cli · GitHub
Since our $wp_version
will always be greater than 4.6, WP-CLI won’t use its wp-settings-cli.php
file. The normal wp-settings.php
file from ClassicPress will be loaded instead. I missed this the first time I looked at this code.
So I think all we need to do is add global $cp_version
here: ClassicPress/src/wp-settings.php at f765dbfa00cf74fd51cae45ffb13cd2536417e4b · ClassicPress/ClassicPress · GitHub
Let me know if you can test that change, I think it should be the last iteration of this fix
I agree with this approach for future changes. We might call it wp-includes/cp-compat.php
.