• eltorowebdesigns

    (@eltorowebdesigns)


    Hi,

    I’d like to purge certain pages (menu/ and product/*) on a schedule. I see in the Advanced settings that there’s a URL to purge the whole cache, but is there a way to only purge certain pages?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter eltorowebdesigns

    (@eltorowebdesigns)

    Also, I keep getting a 401 Unauthorized from nginx when trying to hit the cron job URL through:

    1. a WP cron job (created through the WP Crontrol plugin). I don’t see any error logs, besides Query Monitor just simply telling me that the request returned a 401 Unauthorized lol
    2. a simple curl / wget -O- command while SSH’d in my application on Cloudways

      It does work when I directly load the URL in my browser, though. I’m using the exact URL specified in the “Advanced” tab… is there anything else I’m supposed to do on Cloudflare or on Cloudways to be able to trigger this cron job? I don’t

      In case it’s relevant, I do not have WP Cron disabled. I’ve read that for some sites it’s better to use a server-side cron, but for my client’s use-case they don’t need it; but, if a server-side cron is necessary to implement this cron job I’ll do it. I tried creating a server-level cron job in the “Cronjob Management” section in Cloudways and having it run now, but nothing happened and I couldn’t find any logs for it…
    Plugin Support Ionut Neagu

    (@ionutn)

    Hey,

    It’s not possible to clear those pages only on schedule, but can I learn more on why you want to do that? They should clear on update.

    Thread Starter eltorowebdesigns

    (@eltorowebdesigns)

    @ionutn I have a WooCommerce site that has a Shop (catalog) page and then Single Product pages. You can add to cart on a Single Product page, but you can also add any item to your cart on the Shop page. I have a PHP function in my child theme’s functions.php file that hooks into the ‘woocommerce_is_purchasable’ filter, and it returns false if it’s not currently business hours.

    So when the shop closes for the day:

    What currently happens is that the PHP code runs, online ordering is turned off, and so the “Add to cart” button disappears from the Single Product page but not from the Shop page. I’m assuming that the Single Product page is not cached by default in this plugin, but the Menu page’s HTML is cached and so it needs to be purged in order for the “Add to cart” buttons to disappear from the Shop page.

    And then vice versa for when the shop opens for the day at 11 AM.

    So far I’ve been manually purging the Shop page myself at 11 AM and 6 PM every day, but this is not scalable, especially since I’m a one-man team. It’s only been a week and I’m already tired of having to do this, to be honest. My last resort is not caching the Shop page at all, but the downside of that is that during business hours my page has lower performance (and a lower Google PageSpeed score) when it doesn’t need to…

    I’m wondering: why is it not possible to purge a specific page on a schedule? When I manually purge a specific page, you guys are making a request to Cloudflare on your end, right? Can I not make that same request myself in my theme code, and then turn that into a cronjob? By the way, regarding my previous message in this thread, I’m also confused why I get a 401 Unauthorized error when I try running the “purge the whole cache” cronjob.

    Thread Starter eltorowebdesigns

    (@eltorowebdesigns)

    Hi @ionutn just following up here! You can ignore the last part about the 401 Unauthorized error though, I figured that part out ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.