How to add a flag counter to WordPress
Looking for a flag counter WordPress plugin? You don't need one: add the widget to your sidebar, footer or posts with a Custom HTML block. Free.
Updated · takes about 2 minutes
You don't need a plugin to show visitor flags on WordPress. Live Flag Counter is a small image with a link, so the Custom HTML block that comes with WordPress is all it takes.
Because the code contains no JavaScript, it also works on WordPress.com sites whose plan doesn't allow scripts.
Step by step
-
Create your counter
Design it on our homepage, click Create my counter and copy the code from the HTML tab.
-
Open your widgets or the site editor
With a classic theme, go to Appearance → Widgets. With a block theme (such as Twenty Twenty-Four or Twenty Twenty-Five), go to Appearance → Editor and open your Footer template part. Your dashboard shows whichever of the two your theme uses.
-
Add a Custom HTML block
Click the + button where the counter should go — for example in the sidebar or footer — search for Custom HTML and add the block.
-
Paste the code and save
Paste the code into the block, then click Update (widgets) or Save (site editor). Visit your site to see the counter; your view is the first one counted.
What the code looks like
This is the HTML code. Yours contains your own counter ID instead of YOUR-ID, so always copy it from your counter's page.
<a href="https://liveflagcounter.com/stats/YOUR-ID" target="_blank" rel="noopener"> <img src="https://liveflagcounter.com/c/YOUR-ID.png" alt="Live Flag Counter" width="456" style="max-width:100%;height:auto"> </a>
Tips for WordPress
- To show the counter in a single post or page only, add a Custom HTML block inside that post instead.
- Using Elementor, Divi or another page builder? Add its HTML or Code element and paste the same code.
- Page-caching plugins don't affect the counter: every visitor's browser still loads the image from our server.
- If a lazy-loading plugin is active, exclude the counter image (most plugins let you exclude by URL — enter
liveflagcounter.com). Otherwise a view only counts once the visitor scrolls down to the widget.
Questions
Do I need a WordPress plugin for a flag counter?
No. A plugin would only wrap the same image. The Custom HTML block is built into WordPress and keeps your site lighter.
Does it work on WordPress.com?
Yes. The code is plain HTML — an image inside a link, with no scripts — so you can paste it into a Custom HTML block on WordPress.com too.
Add a flag counter to WordPress
Create your free counter in seconds. No signup, no watermark, no cookies.
Create your counter