plugin = $plugin; add_action( 'admin_init', array( $this, 'cache_settings_info' ) ); } /** * Cache Settings Info * * Displays information on the settings page for helping * to configure Password Protected to work with caching setups. * * @since 2.1 */ public function cache_settings_info() { // Caching Section add_settings_section( 'password_protected_compat_caching', __( 'Having issue with Caching?', 'password-protected' ), array( $this, 'section_caching' ), 'password-protected-compat' ); // Cookies add_settings_field( 'password_protected_compat_caching_cookie', __( 'Cookie Name', 'password-protected' ), array( $this, 'field_cookies' ), 'password-protected-compat', 'password_protected_compat_caching' ); add_settings_field( 'password_protected_documentation', __( 'Documentation', 'password-protected' ), array( $this, 'documentation' ), 'password-protected-compat', 'password_protected_compat_caching' ); // WP Engine Hosting if ( $this->test_wp_engine() ) { add_settings_field( 'password_protected_compat_caching_wp_engine', __( 'WP Engine Hosting', 'password-protected' ), array( $this, 'field_wp_engine' ), 'password-protected-compat', 'password_protected_compat_caching' ); } // W3 Total Cache if ( $this->test_w3_total_cache() ) { add_settings_field( 'password_protected_compat_caching_w3_total_cache', __( 'W3 Total Cache', 'password-protected' ), array( $this, 'field_w3_total_cache' ), 'password-protected-compat', 'password_protected_compat_caching' ); } } /** * Caching Section * * @since 2.1 */ public function section_caching() { echo '
' . __( 'Password Protected does not always work well with sites that use caching.', 'password-protected' ) . '
' . __( 'If your site uses a caching plugin or your web hosting uses server-side caching, you may need to configure your caching setup to disable caching for the Password Protected cookie:', 'password-protected' ) . '
' . esc_html( $this->plugin->cookie_name() ) . '
' . __( 'Can be changed using the `password_protected_cookie_name` filter.', 'password-protected' ) . '
'; } public function documentation() { echo 'Documentation'; } /** * WP Engine Hosting * * @since 2.1 */ public function field_wp_engine() { echo '' . __( 'We have detected your site may be running on WP Engine hosting.', 'password-protected' ) . '
' . __( 'In order for Password Protected to work with WP Engine\'s caching configuration you must ask them to disable caching for the Password Protected cookie.', 'password-protected' ) . '
' . __( 'It looks like you may be using the W3 Total Cache plugin?', 'password-protected' ) . '
' . __( 'In order for Password Protected to work with W3 Total Cache you must disable caching when the Password Protected cookie is set.', 'password-protected' ) . '
' . sprintf( __( 'You can adjust the cookie settings for W3 Total Cache under Performance > Page Cache > Advanced > Rejected Cookies.', 'password-protected' ), admin_url( '/admin.php?page=w3tc_pgcache#advanced' ) ) . '