Forums Forums Search & Filter Pro Cache not updated automatically

Viewing 10 posts - 11 through 20 (of 26 total)
  • Anonymous
    #93453
    This reply has been marked as private.
    Ross Moderator
    #93707
    This reply has been marked as private.
    Anonymous
    #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.
    Anonymous
    #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.
    Anonymous
    #94155

    Hi guys;

    It seems i’m having the same problem. I’m also using acf_form.
    Apart from turning off the use transients setting, is there anything else that needs to be done?
    A few posts in this thread are marked as private, so i’m not sure if following the right directions.

    Conditions seems the same in my case, im using acf_from and we have currently more than 500 items.

    In fact i have filed a ticket in ACF recently with an issue that may be hinting at what is possibly happening. I know this is not directly related to SF&P but it looks definitively related:

    Pablo Liz sent a message:
    Feb 22, 10:06am
    Last Author Edited by is not being updated when using frontend forms.
    It seems i have all required things in the page for it to work. Even repeater fields with media files are working ok including frontend javascript. Having used it in production with more than 40 fields of all types this is so far the only problem i’ve found regarding the front-end form.

    This works normally when using the backend. In our case this is a critical function. Is this a bug or anything specific i should be looking at?

    i have…

    
    <?php acf_form_head(); ?>
    <?php get_header(); ?>
    
    ...
    
    acf_form(array('id'=>'my_frontend_form_id','label_placement' => 'left'))
    
    ...
    
    <?php acf_enqueue_uploader(); ?>
    <?php get_footer(); ?>
    

    I saw another post about revisions not being created when using frontend forms. Maybe its related to that?

    —- Versions —-
    ACF v5.5.8
    WP v4.7.2

    And, here is the response from the plugin Authors:

    Hi Pablo

    Thanks for the email.

    It looks like the ‘_edit_last’ meta is not updated via WP during the ‘update_post()’ function and is manually called by WP during it’s save_post action.

    I’m happy to consider adding this into the acf_form_head() function, but am not sure it would always be desireable.

    For now, you could easily use the ‘acf/pre_save_post’ filter to run the following code from WP:

    
    // Update last edit user
    	update_post_meta( $post_id, '_edit_last', get_current_user_id() );
    
    

    Thanks,
    Elliot

Viewing 10 posts - 11 through 20 (of 26 total)