Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache not cleared for Custom Categories associated with Custom Post Types #693

Closed
raamdev opened this issue Feb 27, 2016 · 14 comments
Closed
Assignees
Milestone

Comments

@raamdev
Copy link
Contributor

@raamdev raamdev commented Feb 27, 2016

A user writes...

I have found out that the plugin doesn't clear the custom categories associated with custom post types.... so I had to prevent the plugin from caching the custom taxonomies at all... it would be great if next update would fix this or let me know if there is any filter that can do the job??

I have not tested or reproduced this yet, so this needs to be tested.


Related: #399

@raamdev raamdev modified the milestone: Next Release Mar 6, 2016
@renzms
Copy link

@renzms renzms commented Mar 14, 2016

@raamdev

I have found out that the plugin doesn't clear the custom categories associated with custom post types.... so I had to prevent the plugin from caching the custom taxonomies at all... it would be great if next update would fix this or let me know if there is any filter that can do the job??

Was not able to reproduce what the customer had experienced.

Steps Taken:

  • Using 000000-dev branch distributable of Comet Cache Pro, I created custom taxonomies, custom post types, and custom categories.
  • Did a test with several different types of posts and different combinations of the custom post type/+custom taxonomy/+custom category to make sure a cache was generated on the clean installation. - Used default settings of Comet Cache and Auto Cache Engine disabled
  • Viewed cache via FTP in the /comet-cache/cache/ directory
  • Cleared cache and checked directory to make sure cache was cleared successfully for Custom Category Folders and Custom Post types
  • Triple checked after 30mins to make sure no cache was auto generated
  • Visited page again as test user to regenerate cache and as expected, cache files only generated when visiting the Custom Categories and Post Types
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Mar 14, 2016

@renzms If you cache a Custom Post Type Category archive view, and then edit a published post that belongs to that Custom Post Type category, does the CPT Category archive cache get cleared automatically?

@renzms
Copy link

@renzms renzms commented Mar 14, 2016

@raamdev

If you cache a Custom Post Type Category archive view, and then edit a published post that belongs to that Custom Post Type category, does the CPT Category archive cache get cleared automatically?

Yes, under Auto Cache Clearing → Auto-Clear "Custom Post Type Archives" Too?, it's set to Yes, if any single Post with a Custom Post Type is cleared/reset; also clear any associated Custom Post Type archive views. Once I edited the post (updated text content, changed Category Type, etc), I checked again under the the Cache Directory and the cache cleared after a few moments.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Mar 14, 2016

@renzms writes...

Once I edited the post (updated text content, changed Category Type, etc), I checked again under the the Cache Directory and the cache cleared after a few moments.

Did you get a Dashboard notification indicating that the associated Category cache was cleared? It shouldn't take "a few moments"; it should happen instantly, as soon as the post is updated, and there should be a Dashboard notification indicating that cache file was cleared. (A screenshot of what you see would be helpful.)

@renzms
Copy link

@renzms renzms commented Mar 15, 2016

@raamdev

Notice appears after editing. Cache is auto cleared.

screen shot 2016-03-15 at 9 09 40 am

It shouldn't take "a few moments"; it should happen instantly,

I verified the Cache was actually clear by checking the directory via FTP, which is probably why it took a few moments but the notice was instant.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Mar 15, 2016

@renzms Thank you. So it sounds like there is no issue here after all. Could you please post the code that you used to register the CPT and the CPT categories?

@renzms
Copy link

@renzms renzms commented Mar 17, 2016

Could you please post the code that you used to register the CPT and the CPT categories?
@raamdev

I actually used this plugin to save some time and created multiple CPT categories: https://wordpress.org/plugins/custom-post-type-ui/

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Mar 18, 2016

I have confirmed the bug.< @renzms it appears that you were not testing Custom Taxonomies.

EDIT: See next comment; there is no bug.

Steps to reproduce the problem

  1. Install, activate, and enable Comet Cache Lite v160227

  2. Install and activate Custom Post Type UI

  3. Add a new Custom Post Type in CPT UI → Add/Edit Post Types:

    2016-03-18_11-56-10

  4. Add a new Custom Taxonomy in CPT UI → Add/Edit Taxonomies:

    2016-03-18_11-55-38

    Also be sure to add a Custom Rewrite Slug for the new Taxonomy so that we can visit URLs to the Archive View for this Taxonomy (which will then get cached by Comet Cache--this is what we're trying to test).

    2016-03-18_12-07-20

  5. Now add several new Taxonomies:

    2016-03-18_11-56-52

  6. Now add and publish a new post with the new Custom Post Type and be sure to assign the new Taxonomies (Actors) to the new post:

    2016-03-18_11-58-37

  7. Once the new CPT is published, we can visit the Archive page for the Taxonomies to see, for example, what Movies the Actor "Raam Dev" has played in. Notice how Comet Cache properly caches this archive view:

    2016-03-18_12-00-30

  8. Now let's remove the Actor "Raam Dev" from the Movie "Inside the Volcano" post. When we do this, Comet Cache should clear the cache file for any Taxonomies associated with this Post (categories, tags, and any custom taxonomies, in this case Actors):

    2016-03-18_12-02-46

    Uh oh, only the cache file for the CPT itself and the Home Page were cleared...

  9. If we visit the Archive View for the Actor "Raam Dev", he should no longer be listed as being in the "Inside the Volcano" movie... but he's still listed there because the cache file for that archive view did not get cleared as expected.

    2016-03-18_12-03-34

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Mar 18, 2016

Well, scratch that. There is no bug. (But it was fun being an Actor in a Movie.)

I remembered there was a setting in Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Custom Post Type Archives" Too? and when I checked that I found that it was disabled.

2016-03-18_12-25-58

Once I enabled that, the automatic clearing of Custom Term Archives worked perfectly:

2016-03-18_12-25-10

2016-03-18_12-22-02


So the primary issue here is that the default for Automatically Clearing Custom Term Archives is disabled, which leads to confusion when users try to test it.

I'm removing the bug label here, but I would like to consider changing this default to enabled, so that users don't have to hunt down this configuration option. If Comet Cache caches Custom Term Archive Views by default, then it should also automatically clear them by default--it makes no sense for the default here to be disabled.

@jaswsinc any opposition to that change?

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Mar 18, 2016

@jaswrks
Copy link

@jaswrks jaswrks commented Mar 22, 2016

@jaswsinc any opposition to that change?

Nope. That sounds like a great idea to me also.

@jaswrks
Copy link

@jaswrks jaswrks commented Apr 8, 2016

@renzms The next step here would be to alter the default value here; changing it from 0 to 1 (enabled). See: https://github.com/websharks/comet-cache-pro/blob/160227/src/includes/classes/Plugin.php#L313

@renzms renzms removed the ready for work label Apr 14, 2016
raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue Apr 15, 2016
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Apr 26, 2016

Next Release Changelog:

  • Enhancement: The the option to automatically clear the cache for Custom Term Archive Views (see Comet Cache → Plugin Options → Automatic Cache Clearing → Auto-Clear "Custom Term Archives" Too?) is now enabled by default. This feature was previously disabled by default, which lead to confusion about why those cache files were not being cleared automatically when a Custom Post Type with a Custom Term Archive View was being used. Props @renzms. See Issue #693.
@raamdev raamdev closed this Apr 26, 2016
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented May 21, 2016

Comet Cache v160521 has been released and includes changes from this GitHub Issue. See the v160521 announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#693).

@wpsharks wpsharks locked and limited conversation to collaborators May 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants