Guest User

Untitled

a guest
May 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. /* Plugin Name: plugin name
  2. Plugin URI:
  3. Description: Descript
  4. Version: 1.0
  5. Author: Author
  6. Author URI:
  7. License: GPLv2 or later
  8. */
  9.  
  10. if ( ! defined( 'ABSPATH' ) ) {
  11. exit; // Exit if accessed directly
  12. }
  13.  
  14. require_once(dirname(__FILE__) . '/lib/visit_stats.php');
  15.  
  16. // Current wordpress user id
  17. $userid = 3;
  18.  
  19. // Getting visit value from user meta
  20. $oldvisitdata = get_user_meta($userid, "visits", true);
  21.  
  22. // For example if it's returning 3
  23.  
  24. // Now increasing the old visits value by 1
  25. $newvisit = $oldvisitdata + 1;
  26.  
  27. // Now update the meta
  28. update_user_meta($userid, 'visits', $newvisit);
Add Comment
Please, Sign In to add comment