Giter Site home page Giter Site logo

Comments (5)

arnowelzel avatar arnowelzel commented on September 17, 2024

My plugin also uses 2000 for the action priority. Since it works, when lowering the priority for JetPack the easiest fix would be to increase the priority in my plugin to some higher value.

Also see here:
4fb9d96

If this works for you, I will include this for the next update.

from lightbox-photoswipe.

wnuczek avatar wnuczek commented on September 17, 2024

Actually it's the other way round. I changed the priority in your plugin.
Just did another check and 98 seems to be highest value, anything above that value causes the error.

from lightbox-photoswipe.

arnowelzel avatar arnowelzel commented on September 17, 2024

Hmm - this is bad news. A priority lower than about 200 will cause conflicts with other plugins - that's the reason why I set it to 2000 to be sure to get the output buffer after all other modifications.

As workaround you can keep your modification with a priority of 90. But I'll have to look into this as lowering the priority below 200 is definetly not an option, as this will break many sites.

from lightbox-photoswipe.

wnuczek avatar wnuczek commented on September 17, 2024

I tinkered with the infinite scroll code and was able to get it to run with your plugin left at 2000 priority.

if ( have_posts() ) {
	// Fire wp_head to ensure that all necessary scripts are enqueued. Output isn't used, but scripts are extracted in self::action_wp_footer.
	ob_start();
	wp_head();
	while ( ob_get_length() ) {
		ob_end_clean();
	}
	ob_end_clean(); //forcing to clean and end the buffer seems to resolve the issue
	$results['type'] = 'success';

It seems to be an issue with output buffer as in case with YoastSEO issue.
Forcing to clean and end the buffer seems to resolve the issue.

I am no PHP expert so I look forward to hear your opinion.

from lightbox-photoswipe.

arnowelzel avatar arnowelzel commented on September 17, 2024

After reviewing the code you mentioned - this translates to:

  1. start output buffering (ob_start())
  2. output the site header (wp_head())
  3. as long as there is anything in the output buffer, delete the buffer content and then end buffering (while ( ob_get_length() ) { ob_end_clean(); })
  4. delete the buffer and end buffering (ob_end_clean())

So what this code wants to achive is to actually execute the WordPress header code but supress the output. That is already a very crude hack. But when opening a buffer it must be closed as well - even if there is nothing in it. I don't understand, why they call ob_end_clean() only if there is anything in the buffer. Also after having called ob_end_clean() the buffer is empty - there is no reason to this in conjunction with while( ob_get_length() ). Also see https://www.php.net/manual/en/function.ob-end-clean.php.

I think this is a bug with the infinite scroll code which should be solved there.

from lightbox-photoswipe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.