Example #1
0
/**
 * Starts caching filter, returns if filter already cached.
 *
 * @param string $id the fragment id
 * @param string $group the fragment group name.
 * @param string $hook name of the action/filter hook to disable on fragment found
 * @param mixed $data the data returned by the filter
 * @return mixed
 */
function w3tc_fragmentcache_filter_start($id, $group = '', $hook = '', $data)
{
    _w3tc_caching_fragment($id, $group);
    $fragment = w3tc_fragmentcache_get($id, $group);
    if (false !== $fragment) {
        if ($hook) {
            global $wp_filter;
            $wp_filter[$hook] = array();
        }
        return $fragment;
    }
    return $data;
}
/**
 * Starts caching filter, returns if filter already cached.
 *
 * @param string  $id    the fragment id
 * @param string  $group the fragment group name.
 * @param string  $hook  name of the action/filter hook to disable on fragment found
 * @param mixed   $data  the data returned by the filter
 * @return mixed
 */
function w3tc_fragmentcache_filter_start($id, $group = '', $hook = '', $data)
{
    _w3tc_caching_fragment($id, $group);
    $fragment = w3tc_fragmentcache_get($id, $group);
    if (false !== $fragment) {
        if ($hook) {
            remove_all_filters($hook);
        }
        return $fragment;
    }
    return $data;
}