Advertisement
Guest User

adsense ip

a guest
Sep 21st, 2018
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <?php
  2. if (!in_array(get_the_user_ip(), array( '127.0.0.2', '127.0.0.0' ) )) {
  3. ?>
  4. código adsense
  5. <?php
  6. }
  7. ?>
  8.  
  9. añadir al functions.php de tu theme, al final del todo:
  10.  
  11. function get_the_user_ip() {
  12. if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
  13. $ip = $_SERVER['HTTP_CLIENT_IP'];
  14. } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
  15. $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
  16. } else {
  17. $ip = $_SERVER['REMOTE_ADDR'];
  18. }
  19. return apply_filters( 'wpb_get_ip', $ip );
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement