Plugin Directory

Changeset 1538689


Ignore:
Timestamp:
11/22/2016 09:47:58 PM (9 years ago)
Author:
andy
Message:

batcache: Use Plugins API rather than the global variable

https://github.com/Automattic/batcache/commit/19ae1536e3ea8a02bf62ce5aeedbe073a20ea892

File:
1 edited

Legend:

Unmodified
Added
Removed
  • batcache/trunk/advanced-cache.php

    r1538688 r1538689  
    538538    return;
    539539
    540 $wp_filter['status_header'][10]['batcache'] = array( 'function' => array(&$batcache, 'status_header'), 'accepted_args' => 2 );
    541 $wp_filter['wp_redirect_status'][10]['batcache'] = array( 'function' => array(&$batcache, 'redirect_status'), 'accepted_args' => 2 );
     540//WordPress 4.7 changes how filters are hooked. Since WordPress 4.6 add_filter can be used in advanced-cache.php. Previous behaviour is kept for backwards compatability with WP < 4.6
     541if ( function_exists( 'add_filter' ) ) {
     542    add_filter( 'status_header', array( &$batcache, 'status_header' ), 10, 2 );
     543    add_filter( 'wp_redirect_status', array( &$batcache, 'redirect_status' ), 10, 2 );
     544} else {
     545    $wp_filter['status_header'][10]['batcache'] = array( 'function' => array(&$batcache, 'status_header'), 'accepted_args' => 2 );
     546    $wp_filter['wp_redirect_status'][10]['batcache'] = array( 'function' => array(&$batcache, 'redirect_status'), 'accepted_args' => 2 );
     547}
    542548
    543549ob_start(array(&$batcache, 'ob'));
Note: See TracChangeset for help on using the changeset viewer.