• Resolved distinctly

    (@distinctly)


    Hi Tobias,

    Firstly, thank you for the great plugin!

    I was just wondering whether Tablepress supports WP Rocket properly?

    I’m reading in another thread that whenever a table is updated, the entire cache is deleted. This user is using WP Super Cache. (link: https://wordpress.org/support/topic/disable-clearing-of-entire-cache-on-table-update/)

    I am using another caching plugin, WP Rocket, and the cache doesn’t seem to clear every time I update a table. I would like this to happen. Could you please confirm whether Tablepress supports caching with WP Rocket?

    Thank you.

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    At this time, TablePress does indeed only clear the cache of a few caching plugins whenever a table is updated. WP Rocket is not yet among those – I’ll first have to research if they offer a programmatic way to do this – which is on my To Do list.

    Thus, at this time, you’ll have to manually flush the WP Rocket cache, if you are running into caching issues. TablePress will of course still work fine.

    Regards,
    Tobias

    Thread Starter distinctly

    (@distinctly)

    Hi Tobias,

    Many thanks for your response!

    WP Rocket seems to have a way programmatically to clear the cache – https://docs.wp-rocket.me/article/494-how-to-clear-cache-via-cron-job

    I was wondering whether I could edit the Tablepress code myself manually to call the function listed on that page? If so, would it be possible to direct me to the correct location?

    The code is listed here:

    <?php 
    // Load WordPress.
    require( 'wp-load.php' );
    
    // Clear cache.
    if ( function_exists( 'rocket_clean_domain' ) ) {
    	rocket_clean_domain();
     }
    
    // Clear minified CSS and JavaScript files.
    if ( function_exists( 'rocket_clean_minify' ) ) {
    	rocket_clean_minify();
    }
    

    Thank you again and understand if it is too much to ask!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for sharing this! Yes, that should be the necessary code. You could indeed add that to your TablePress copy. In particular, you’ll want to extend the _flush_caching_plugins_caches function in the /models/model-table.php file, see https://github.com/TobiasBg/TablePress/blob/a49bed720b50bbfe667afa054a8cf205ae18d2cc/models/model-table.php#L725-L755 , with only this:

    // WP Rocket.
    if ( function_exists( 'rocket_clean_domain' ) ) {
    	rocket_clean_domain();
    }

    The second part of the code is for flushing the CSS cache, and that could go into https://github.com/TobiasBg/TablePress/blob/a49bed720b50bbfe667afa054a8cf205ae18d2cc/classes/class-css.php#L430-L444

    Regards,
    Tobias

    Thread Starter distinctly

    (@distinctly)

    Hi Tobias,

    Thank you so much – that code worked perfectly. Appreciate your assistance.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias
     
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Thread Starter distinctly

    (@distinctly)

    Done, thank you!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks, I really appreciate it!

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Tablepress Caching and WP Rocket’ is closed to new replies.