Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenhornet79/afcbfd0926a3246854544cccf59349a6 to your computer and use it in GitHub Desktop.
Save greenhornet79/afcbfd0926a3246854544cccf59349a6 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'leaky_paywall_filter_is_restricted', 'zeen_bypass_this_user_agent', 20, 3 );
function zeen_bypass_this_user_agent( $is_restricted, $settings, $post_id ) {
$bypass_value = 'Googlebot';
if ( isset($_SERVER['HTTP_USER_AGENT'] ) ) {
$user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] );
if ( strpos( $user_agent, $bypass_value ) !== false ) {
return false;
}
}
return $is_restricted;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment