-
Notifications
You must be signed in to change notification settings - Fork 46
Minit Action and Filter Hooks
Viktor Szépe edited this page Nov 30, 2016
·
5 revisions
Called when the global cache gets purged.
This is not called but hooked by Minit, you may clear the cache with do_action( 'minit-cache-purge-delete' );
@todo create a fallback
Disable async script loading. (boolean)
Exclude specific style and script handles. (array)
Modify minited file URL-s.
Change the content of minited files.
Default cache expiration time of all minited files' data.
Cache expiration time of minited style's and script's data.
Support custom directory structure.
add_filter( 'minit-asset-local-path', 'minit_custom_content_dir', 10, 2 );
function minit_custom_content_dir( $local_path, $item_url ) {
// Bail out if get_local_path_from_url() succeeded
if ( false !== $local_path ) {
return $local_path;
}
// Replace custom MU plugin URL
$full_path = str_replace( WPMU_PLUGIN_URL, WPMU_PLUGIN_DIR, $item_url );
// Replace custom plugin URL
$full_path = str_replace( plugins_url(), WP_PLUGIN_DIR, $full_path );
// Replace custom theme URL
$full_path = str_replace( get_theme_root_uri(), get_theme_root(), $full_path );
// Replace remaining custom wp-content URL
$full_path = str_replace( content_url(), WP_CONTENT_DIR, $full_path );
if ( file_exists( $full_path ) ) {
return $full_path;
}
return false;
}