• Resolved Zero G Marketing

    (@circusstrategic)


    On the front-end, the correct table data is showing (under specifications) when I’m logged in to the site, but anyone who isn’t sees old data. Any idea what is going on?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    This indicates a caching problem. It might be worth trying to turn off the TablePress output cache for this table. For that, please extend the Shortcode that you are using to embed the table on that page to

    [table id=16 cache_table_output=false /]

    Regards,
    Tobias

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi @ulicgn,

    (I have received an email notification that you had also posted in this thread. I’m not sure why your post is not showing up, so that my reply below is to the text that I had received in the email.)

    You are right, the caching is intentional, and it is more of a caching invalidation problem. Apparently, the transient is not properly cleared on circusstrategic’s site.

    The idea of this caching is to cache the rendered HTML output of the table (actually the md5 hashed full table Shortcode) in a transient, so that the HTML generation process does not have to be repeated on every page load (it can be potentially computationally expensive, due to formula and Shortcode evaluation). The caching is however skipped for logged-in users and if the cache_table_output parameter is set (which can also be done globally with this TablePress Extension).
    The cache is either flushed every day (when the transient expires) or whenever the table is edited/saved. This works by having another transient that contains a list of all transients with cached versions for this table, which are then all invalidated.

    Now, in your case, this flushing does not happen, because wp_update_post( $post_id_of_table) is a “lower level function” than the cache flushing. Therefore, if you want to update content programmatically, I would actually not recommend modifying the internal post data, but to use the TablePress functions from model-table.php (I think the controller-admin-ajax.php shows how to do this nicely, in the ajax_action_save_table() method.). This would include the cache flushing and would also be more future-proof, in case anything changes in the internal data storage mechanism in the future.

    Best wishes,
    Tobias

    Bless you @tobiasbg for replying to my disappeared posting! In my opinion it was related to the original poster’s problem since I had the same problem/symptoms, but a moderator decided to delete it and recommended creating a new thread. However I did not have the time to re-write the whole text. So thank you for pointing out a better way to achieve cache flushing. My workaround for now is to limit all operations that change the content to logged-in users (before, I had allowed anonymous requests with a secret key parameter to trigger changes).

    Regarding the OP’s ( @circusstrategic ) problem I can at least confirm that indeed the cache does expire correctly after 24 hours, so that is the longest time the old content is kept. From my experience, it might help to save the table once more after changing it, just to make sure the cached content of the rendered table is invalidated/refreshed.

    Regards

    Uli

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Uli,

    you are very welcome! Thanks for the explanation about your post going missing. Yes, that’s pretty unfortunate then ??

    Great to hear that the suggestion will help! And indeed, re-saving again can sometimes help, and sometimes it can be good to manually remove all transients related to TablePress as well (but this normally requires tools like phpMyAdmin, so that it’s not that trivial).

    Regards,
    Tobias

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Different Data Showing When Not Logged In’ is closed to new replies.