Created
February 7, 2017 13:50
-
-
Save gwin/c2674b3b7d05e4fe9cfac99071df0a0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode("current_user_id", "current_user_id"); | |
function current_user_id() { | |
$user = wp_get_current_user(); | |
if( isset( $user->ID ) ) { | |
return $user->ID; | |
} else { | |
return "0"; | |
} | |
} | |
// wtedy w wp-admin / Pages w treści strony można wstawić [current_user_id] | |
// i będzie to wyświetlać id obecnie zalogowanego usera. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment