You are here
Home > Php > Creating Visitors Counter in WordPress

Creating Visitors Counter in WordPress

Hello Friends, I was working on a project which was required to show visitors count on website, So I developed code for that and now I am sharing it so that if anyone required, can use it.

This code utilises get_option, add_option and update_option predefined wordpress function which stores key value  pair data in options table of wordpress. So here I am going to create visitors key in options table using add_option function and it will be incremented every time user visits the website. To show visitors count use [visitors] shortcode in page, post, sidebar or wherever you want.

You just need to paste this code in functions.php file.

or (if you want counter for specific page i.e contact page)





Please like & share

Rajesh Kumar Sahanee
I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listening music in my free time.