Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Cache not updated automatically

Viewing 10 posts - 11 through 20 (of 27 total)
  • Ross Moderator
    #93135

    Hi Sanna

    The answer is yes to both, we just use a filter on save_post (standard WP) to detect when a post is updated, and also update our cache for that post in the background.

    The fact that on both versions, S&F was not behaving, then after my work S&F was working on dev site.. tells me that something has not been copied over correctly from dev to live.

    Did you do a full site copy/move?

    I would just double check by doing the following:

    1) Via FTP, copy your theme & child theme from dev -> live

    2) Via FTP, copy the active version of S&F from dev -> live

    3) Turn off use transients in S&F settings (I think I disabled this on your dev site)

    If its still not working let me know and I’ll take a quick look at the live site

    hamren
    #93453
    This reply has been marked as private.
    Ross Moderator
    #93707
    This reply has been marked as private.
    hamren
    #93710
    This reply has been marked as private.
    Ross Moderator
    #93727
    This reply has been marked as private.
    Ross Moderator
    #93729
    This reply has been marked as private.
    hamren
    #93915
    This reply has been marked as private.
    Ross Moderator
    #94086
    This reply has been marked as private.
    Ross Moderator
    #94147

    Hi Sanna

    Ok I have some good and bad news for you.

    I’ve tracked down the issue, but I don’t know whats causing it (and its not S&F).

    I’ll try to explain a little:

    To detect when a new post is created we use the WP action save_post

    add_action( 'save_post', 'post_saved', 10000 );

    I’ve added this to the bottom of your functions.php.

    Then inside this function, we can use get_post_meta to retrieve the value of your date (S&F needs to do this to be able to store this info).

    The problem is, using get_post_meta($post_id, 'datum', true); is failing (returning nothing, like it doesn’t yet exist), but ONLY when you create / update a post from the frontend, and only when you have a load of posts in your database.

    When you add a new report via admin, the save_post is triggered, but the date variable is there.

    When you do it on a site with a low number of posts, its also there.

    Its just in this circumstance using save_post and get_post_meta does not work.

    Where to go from here?

    I think its a good idea to get in touch with your host, because of the number of posts looking like its an issue, then it could be server related.

    If that doesn’t work, I would get in touch with ACF, and ask why get_post_meta doesn’t return anything in the save_post action.

    Once you can get this working in your setup, then S&F can also detect this data, and use it properly.

    A quick way to test this yourself:

    1) I’ve added code to the bottom of your functions.php which logs every save_post on your site, with the date and post ID.
    2) All save info is being logged to wp-content/debug.log
    3) To test this, open wp-content/debug.log, empty the file and save it (and upload the blank file back to the server) – this is just to clear the log and make it more readable.
    4) Now goto your frontend form, and create a new report.
    5) Download a new copy of debug.log and check it, you will find a line like:
    [02-Mar-2017 20:32:02 UTC] Post saved, ID: 3761, meta date:
    Notice, there is no meta date.
    6) Goto admin, and create a new report, check debug.log again (make sure to grab a fresh copy), you will see a line like:
    [02-Mar-2017 20:36:06 UTC] Post saved, ID: 3764, meta date: 20170312
    Notice how this time the post has the date with it.

    For some reason when you had only a few posts, beheviour was the same a step (6), but now with many posts its doing step (5).

    I hope that helps!

    Ross Moderator
    #94151
    This reply has been marked as private.
Viewing 10 posts - 11 through 20 (of 27 total)

The topic ‘Cache not updated automatically’ is closed to new replies.