jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Stylesheet simple-payments.css is always being loaded.

Open remkus opened this issue 9 years ago • 8 comments

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.

remkus avatar Aug 08 '17 15:08 remkus

619779-zen as well

aheckler avatar Aug 08 '17 15:08 aheckler

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' );

aheckler avatar Aug 08 '17 15:08 aheckler

cc: @artpi && #7511

georgestephanis avatar Aug 08 '17 16:08 georgestephanis

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.

georgestephanis avatar Aug 08 '17 16:08 georgestephanis

Reported also in 621712-zen

lschuyler avatar Aug 08 '17 20:08 lschuyler

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.

collinbarrett avatar Aug 09 '17 19:08 collinbarrett

628570-zen

ntpixels avatar Aug 11 '17 18:08 ntpixels

Temporarily, you can fix this way.

thegulshankumar avatar Sep 02 '17 08:09 thegulshankumar