Viewing 15 replies - 1 through 15 (of 24 total)
  • Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    What are your home and site URLs set to?

    If woo is using custom post types, then it should update the shop page IF you’re using an archive template. But without a way to detect that the page should be edited, it defaults to that item page, the front page, and the cats and tags.

    Hi Mika,

    I’m not sure if I totally understood your questions, let’s try…

    What are your home and site URLs set to?

    Are you referring to the settings -> permalink? These are set to “user defined structure” (translated from German, I am not sure if this is the exact wording here) with "/blog/%postname%/"

    Further down on settings->permalink there is an option for “permalink base products” which is set to “user defined base”, too, with “/shop”

    If woo is using custom post types, then it should update the shop page IF you’re using an archive template.

    I am not sure if I understand this… I do not really know what a custom post type is, frankly. The shop page itself seems to be a page (seems to be empty).

    But without a way to detect that the page should be edited, it defaults to that item page, the front page, and the cats and tags.

    Just looking at the path, can’t you just programmatically check that the parent folder is always purged to. So basically, if /a/b/c/ was edited then purge:

    /a/b/c/ (current child page)
    /a/b/ (parent)
    /a/

    (parent of parent)

    In most cases there will be just the child and one parent, like in my case with /shop/product/ and /blog/blogpost/

    Best,
    Jens

    Thread Starter nachtigall

    (@nachtigall)

    Sorry, don’t get confused, the last post was from a friend’s computer but it was me ?? Best, Jens

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    What are your home and site URLs set to?

    Go to WP Admin -> Settings -> General.

    WordPress Address (URL) and Site Address (URL)

    Just looking at the path, can’t you just programmatically check that the parent folder is always purged to.

    I could, but this is what would actually happen:

    Post /a/b/c/ is edited, and then the purge would do this:

    Purge /a/b/c/
    Purge /a/b/
    Purge /a/
    Purge /

    And we’re back to purging the whole thing. There’s not a great way to detect stop points.

    The thing is this is the FIRST time I’ve heard of this being a problem. How often are you adding in new products or editing existing ones?

    Thread Starter nachtigall

    (@nachtigall)

    Hi,

    thanks for getting back.

    WordPress Address (URL) is set to: https://www.fiveroasters.de
    Site Address (URL) is set to: https://www.fiveroasters.de

    Post /a/b/c/ is edited, and then the purge would do this:

    Purge /a/b/c/
    Purge /a/b/
    Purge /a/
    Purge /

    And we’re back to purging the whole thing. There’s not a great way to detect stop points.

    The whole thing? I thought that this would be /.* and not /

    The thing is this is the FIRST time I’ve heard of this being a problem. How often are you adding in new products or editing existing ones?

    It is not only the /shop but also /blog. I think it is really a problem if I add/edit a product or blog post and it does not show up on /shop or on /blog: User sees new blog or product by means of RSS / Mail / Facebook, goes to this post/product and then to blog overview or shop overview and, peng, the product or blog post is not there.

    A workaround might be to purge just everything when something was added, but the “Purge all” button is only available to admins, not to the role “shop manager” (who edit/add products or blog posts at the site)

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Okay I think there’s actually something conflicting with the plugin then, because with that setup, the /blog/ urls should always be getting flushed! It’s getting the permalink structures from get_permalink

    Is it updating the RSS properly? If that’s the case, what other plugins are you running?

    Thread Starter nachtigall

    (@nachtigall)

    Purging of https://www.fiveroasters.de/feed/ works (just tested by editing a blog post: the feed was correctly purged).

    Used plugins are:

    Akismet
    Easy FAQ with Expanding Text
    Google XML Sitemaps
    Groups
    MailChimp for WordPress Lite
    Paymill
    Page Builder by SiteOrigin
    Varnish HTTP Purge
    WooCommerce Germanized
    WooCommerce Google Analytics Integration
    WooCommerce PDF Invoices & Packing Slips
    WooCommerce PDF Invoices & Packing Slips Premium Templates
    WooCommerce
    WP Overnight Sidekick
    wpSEO

    Just another idea: I use a child theme (I guess most other people using such advanced things like varnish do so as well). Would it be possible to have a filter or action to which the array of purged URLs are passed? Then I could just hook into this action and add my “/blog/” and “/shop/” to it, and all is good.

    I looked at your code, but I am new to wordpress. Can after_purge_url be used for this?

    If not, can you provide such a filter/action? Looking at the documentation maybe a simple little filter like vhp_purge_urls would do. I’d then hook into this with my child theme.

    PS I think this approach would also help for other stuff, e.g. to easily allow people to have multi-varnish support if they want. For this you could have a filter like vhp_varnish_ips or similar

    Thread Starter nachtigall

    (@nachtigall)

    PPS vhp_purge_paths (just an array of absolute paths not urls like [/, /blog-post-path, /cat-path] would be better then vhp_purge_urls.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Child theme is not a concern.

    https://github.com/Ipstenu/varnish-http-purge/blob/master/plugin/varnish-http-purge.php#L190

    The thing is it’s Already doing most of that. The fact that it’s flushing the feed means it’s calling those calls. I’m not sure how to tell it to grab the others efficiently, so this will take a while. You won’t get a fast fix.

    Can you test if varnish flushes properly with w3tc? Yes, it’s a separate plugin, but we share similar logic.

    Thread Starter nachtigall

    (@nachtigall)

    Yes, I will test with w3tc but why not just adding these filter hooks anyway?

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I’ll consider it.

    This plugin was meant to be a bare bones simple tool, with limited complications. I’m loathe to add things in without serious consideration, which is also why there’s no multiple IPs for varnish at this time.

    I’m not just going to add things in because people ask, without talking not my partner on this and going over all the pros and cons.

    Thread Starter nachtigall

    (@nachtigall)

    It works with w3tc

    When editing /blog/roasters-united-treffen-auf-mallorca/ then your plugin purges the following:

    "PURGE /category/roasters-united/ HTTP/1.0"
    "PURGE /blog/roasters-united-treffen-auf-mallorca/ HTTP/1.0"
    "PURGE /feed/rdf/ HTTP/1.0"
    "PURGE /feed/rss/ HTTP/1.0"
    "PURGE /feed/ HTTP/1.0"
    "PURGE /feed/atom/ HTTP/1.0"
    "PURGE /comments/feed/atom/ HTTP/1.0"
    "PURGE /comments/feed/ HTTP/1.0"
    "PURGE /blog/roasters-united-treffen-auf-mallorca/feed/ HTTP/1.0"
    "PURGE / HTTP/1.0"

    whereas w3tc purges these:

    "PURGE / HTTP/1.1"
    "PURGE /blog/ HTTP/1.1"
    "PURGE /blog/page/2/ HTTP/1.1"
    "PURGE /blog/page/3/ HTTP/1.1"
    "PURGE /feed/ HTTP/1.1"
    "PURGE /blog/roasters-united-treffen-auf-mallorca/ HTTP/1.1"
    "PURGE /([a-z0-9_\\-]*?)sitemap([a-z0-9_\\-]*)?\\.xml HTTP/1.1"

    So /blog/ is in here (even /blog/page/2/ and /blog/page/3/ are in, which is nice and correct actually).

    (but I really do not want to use w3tc as it goes very deep into the whole system, I used it for some time but deinstalled it later. I’d really rather like to use your plugin ??

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Okay, I’ll see what logic is missing and see if I can fold that in without making the plugin super heavy.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Solved the /blog/ part.

    The sub-pages, I see what they’re doing. Not sure I want to have this plugin get that heavy.

    Regarding the shop URL, is that a specific page that has a short code on it, or is it something auto-generated by Woo?

    Thread Starter nachtigall

    (@nachtigall)

    Solved the /blog/ part.

    Cool ?? Can you commit this on https://github.com/Ipstenu/varnish-http-purge, so I can test it?

    The sub-pages, I see what they’re doing. Not sure I want to have this plugin get that heavy.

    I do not understand what should be heavy about this? Is it because, it is a few purge requests more? (In its easiest form just do a "/blog/page/[0-9]*" request regex).

    If pages get stale, then these must be purged immediately, otherwise users will see incorrect pages and that’s really a heavy error. Regarding caching there is nothing worse than delivering a stale page. I’d rather do a Purge too often, than having stale pages in the cache ?? (and these are not even unnecessary, “too often” Purges, they are correct and needed)

    Regarding the shop URL, is that a specific page that has a short code on it, or is it something auto-generated by Woo?

    This page (the one for /shop/) is just empty (it exists as page though), no shortcode in it. Here are the available shortcodes for woocommerce. There is no shortcode for a shop in it, so I think that it is auto-generated somehow.

    …. just quickly testing with w3tc ….

    When I edit /shop/filter-stellers-jay/, then w3tc purges these pages:

    "PURGE / HTTP/1.1"
    "PURGE /blog/ HTTP/1.1"
    "PURGE /blog/page/2/ HTTP/1.1"
    "PURGE /blog/page/3/ HTTP/1.1"
    "PURGE /feed/ HTTP/1.1"
    "PURGE /shop/filter-stellers-jay/ HTTP/1.1"
    "PURGE /([a-z0-9_\\-]*?)sitemap([a-z0-9_\\-]*)?\\.xml HTTP/1.1" 501 497 "-" "W3 Total Cache/0.9.4.1"

    As you’ll notice /shop/ is not among it (which is an error). (BTW, the 2nd, 3rd and 4th would not really be necessary, but as said above, rather ones too often then ones too less ??

    Hint: According to API you could do:
    $shop_page_url = get_permalink( wc_get_page_id( 'shop' ) );

    Last not least I want to say: Thanks for getting this far already, really great support!

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Page / Product edit should purge parent folder like /blog/ or /shop/’ is closed to new replies.