Stylesheet simple-payments.css is always being loaded.
Steps to reproduce the issue
See topic: https://wordpress.org/support/topic/what-is-simple-payments-module-and-how-do-i-disable-it/
What I expected
To simple-payments.css not being loaded when I don't have the module activated.
What happened instead
It's being loaded everywhere.
619779-zen as well
Workaround is to filter it out like so:
function dont_load_payments_css( $tools ) {
$index = array_search( 'simple-payments/simple-payments.php', $tools );
if ( false !== $index ) {
unset( $tools[ $index ] );
}
return $tools;
}
add_filter( 'jetpack_tools_to_include', 'dont_load_payments_css' );
cc: @artpi && #7511
The issue is that this code here:
https://github.com/Automattic/jetpack/blob/e3fec882a814c142eac68e4108a816af8075eddd/modules/simple-payments/simple-payments.php#L38
is enqueueing the stylesheet, instead of registering it for later enqueue as it is used.
When the shortcode or whatever is being processed during the_content() or whatever, we can just enqueue it then and it will print in the footer. Which is 100% fine and the preferred way of doing things.
cc: @artpi for feedback on where the enqueues should be located in the code.
Reported also in 621712-zen
Tried adding https://github.com/Automattic/jetpack/issues/7609#issuecomment-320992608 workaround to my theme's functions.php. That did not prevent the css from getting loaded on all pages.
628570-zen
Temporarily, you can fix this way.