Vous pouvez afficher les adresses IP des utilisateurs dans les articles et les pages à l’aide d’un shortcode. Cela aidera vos utilisateurs à connaître leur adresse IP facilement.
Instructions : Ajoutez le code suivant au fichier functions.php de votre thème WordPress.
function display_user_ip() { $ip = $_SERVER['REMOTE_ADDR']; return $ip; } add_shortcode('user_ip', 'display_user_ip');
[ip]
Vous pouvez également apprécier l’ajout d’un shortcode après le contenu dans_category.
How Do I Do That On A Non WordPress Website?
This snippet works only on WordPress sites.
You have to use ‘[user_ip]’ as shortcode not ‘[ip]’. Then it will work..!!!!!!
IS NOT working !!!!!!!!!!!!!!
You have to use ‘[user_ip]’ as shortcode not ‘[ip]’. Then it will work..!!
it works… if you are embedding, use
Plz be kind to the code writer.
He helped me a lot without contact.
Change ip to user_ip.
You could notice this litte mistake if you rewrite the code instead of it.
I added this snippet to the function.php, but I didn’t see any IP address show on my website.
Can you tell me more about this? Thanks.
You have to use ‘[user_ip]’ as shortcode not ‘[ip]’. Then it will work..!!!!
What are the benefits of displaying the the users I.P address in your posts and pages?
It’s just a choice, if you wanted to show someone you knew their IP. It really serves little purpose unless you’re wanting to point out, “Hey – I know where you’re coming from… here’s your address…”, or if you provide a service for your users that gives them their IP address as seen by/on the internet. Unless you have a need, I wouldn’t push that information out to the public.