• Hi,

    I love your plugin but it is giving me a small problem.

    In content/plugins/picturefillwp/inc/class-picturefill-wp.php
    You set a transient on the_content. You do this based on the post ID.

    But the following happens on the home page.

    1. I display the 2 newest posts
    2. I get a theme option with:
      echo apply_filters('the_content', get_option('theme_tinymce_formated_option'));

      This option has text from tinymce and basicly works the same as a post. content wise.

    3. You plugin checks for cache based on get_the_ID() which is post #2, which it finds as it’s fetched/created above.
    4. You plugin displays the cached version of post nr 2 instead of my theme option.

    If your plugin should cache something that so many plugins might affect is a different debate.

    But I do have a way to solve this. instead of basing this on a post id which might not even exist. why don’t you create a (md5?)hash of the given content and use that hash as the transient key.

    That way if an author fixes a typo or a other plugin changes the_content your plugin won’t hit the cache because a single letter change will give a different key.

    For now I quoted the cache out entirely.

    Hope you will consider this.

    https://www.ads-software.com/plugins/picturefillwp/

Viewing 1 replies (of 1 total)
  • Plugin Author kylereicks

    (@kylereicks)

    You’re right, I hadn’t considered that use case. Thanks very much for bringing it to my attention.

    I really like your idea. It could save the trouble of checking if the post had been updated since the transient was set. I’m going to do a little research to make sure there aren’t any performance implications I’m not thinking of, but a hash sounds like an efficient solution.

    Thanks again for sharing your ideas.

Viewing 1 replies (of 1 total)
  • The topic ‘Cache is breaking my site’ is closed to new replies.