Making WordPress.org


Ignore:
Timestamp:
04/03/2018 12:10:39 AM (8 years ago)
Author:
coreymckrill
Message:

WP15: Add locale to cache key string

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wp15.wordpress.net/public_html/content/mu-plugins/locales.php

    r6986 r7003  
    3030
    3131add_action( 'plugins_loaded', __NAMESPACE__ . '\textdomain' );
     32
     33/**
     34 * Modify the key for WP Super Cache to take locale into account.
     35 *
     36 * @param string $cache_key
     37 *
     38 * @return string
     39 */
     40function cache_key( $cache_key ) {
     41    $locale = get_locale();
     42
     43    if ( $locale ) {
     44        $cache_key .= '-' . $locale;
     45    }
     46
     47    return $cache_key;
     48}
     49
     50add_filter( 'supercache_filename_str', __NAMESPACE__ . '\cache_key' );
    3251
    3352/**
Note: See TracChangeset for help on using the changeset viewer.