• Resolved lostnotstranded

    (@lostnotstranded)


    Hi,
    First of all, thank you for all the work you’ve out into Autoptimize! It’s a great plugin that works very well, and I use it on a lot of sites.

    One question I had was if it’s possible to retrieve the cached file names somehow to use in other functions.

    If possible, let me know please!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    yes, you can use the autoptimize_filter_cache_getname filter or the autoptimize_action_cache_file_created action ??

    Thread Starter lostnotstranded

    (@lostnotstranded)

    Thanks! Is there any official documentation on how to use those filters/actions? i.e. if I want to get just the CSS file or just the JS file, how would I do that?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    here’s a basic example where the full path of the cached file is written to the error-log;

    add_action( 'autoptimize_action_cache_file_created', 
    	function( $cachefile ) {
    		error_log( $cachefile ); 
    	}
    );

    to differentiate between the JS & CSS-files you can look at file suffix at the end of the string using e.g. pathinfo or simple strpos searches? ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Function to get the cached file names?’ is closed to new replies.