Main Features
- Track views using REST API + Vanilla JS, excluding bots and crawlers
- Prevent duplicate counts using sessionStorage or localStorage
- Supports view counters by: total, day, week, month
- Auto-insert feature: automatically injects the shortcode before/after post content (per post type)
- New shortcode attributes:
icon="true"andschema="true"for inline icon and Schema.org SEO data class="..."attribute to add custom CSS classes for flexible styling- Trending system: calculates rising posts based on hourly view acceleration (via WP-Cron)
- Stores data in separate meta keys like
_init_view_count– no conflict with other plugins/themes - Beautiful shortcode templates, fully overrideable from your theme (WooCommerce-style)
- Fallback thumbnail included for posts without featured image
- Admin Dashboard widget shows top viewed posts at a glance
- Built-in Shortcode Builder UI for generating and previewing shortcodes
- Batch view tracking: store multiple views locally and send in bulk – reduces REST calls
- Strict IP check: blocks repeated views from the same IP using hashed caching
- No tracking, no custom tables, no bloat – uses postmeta and transients only
Flexible View Display with Shortcodes
The plugin includes 3 main shortcodes:
[init_view_count]: Display the current view count inside a post (supports total/day/week/month, format: raw/formatted/short)[init_view_list]: Show a list of the most viewed posts (customizable post type, category, tag, range, layout, class…)[init_view_list range="trending"]: show currently trending posts based on real-time view spikes[init_view_ranking]: displays a tabbed ranking board (All Time / Today / This Week / This Month), powered by REST API and JavaScript
You can customize number of posts, layout style, filter by category, tag, or post type. Templates can be overridden via your theme to fully match your site’s design. See the documentation: Using the shortcode in Init View Count.
Ready-to-Use REST API
Init View Count provides two REST API endpoints for easy integration with frontend apps or headless WordPress setups:
POST /wp-json/initvico/v1/count
Send a post_id or an array of [post_id1, post_id2, ...] after scroll + delay (supports batch view tracking to update multiple posts at once).
GET /wp-json/initvico/v1/top
Retrieves the most viewed posts. See the documentation: Using the /top REST API in Init View Count.
Supported parameters:
range: one oftotal,day,week, ormonth(selects the time range for view counts)range=trending: returns posts with the fastest-growing views (trending)post_type: post type to query, defaults topostnumber: number of posts to retrieve (default: 5)page: which result page to return, used withnumberfor paginationfields:minimal(lightweight) orfull(detailed response)tax: taxonomy name (e.g.category,tag,genre)terms: comma-separated term slugs or IDs to filter byno_cache=1: disable caching to always return the latest data
Easy Template Overrides
You can override any display template by adding a file to your theme at:
your-theme/init-view-count/[template-name].php
Example override for a grid layout:
your-theme/init-view-count/view-list-grid.php
Quick Installation
- Download and unzip the plugin into
/wp-content/plugins/init-view-count/ - Activate it via the WordPress admin Plugins menu
- Go to Settings → Init View Count to configure options
- Use shortcodes in your content or widgets
- You can configure Batch view tracking in settings (1 = real-time, >1 = send after batching).
Tabbed Post Ranking by Time Range
Version 1.3 introduces the [init_view_ranking] shortcode — a tabbed UI showing top viewed posts by time (day, week, month, all time).
It uses the REST API under the hood and includes skeleton loading to prevent layout shift during fetch.
Example:
[init_view_ranking tabs="week,month" number="5"]
You can place it on a dedicated /ranking page or anywhere via block, widget, or builder.
Compatibility & Performance
- Compatible with WordPress 5.5+
- Requires PHP 7.4 or higher
- Works with major themes (Astra, Blocksy, Hello…)
- Uses Vanilla JS, no jQuery dependency
For Developers
Init View Count provides a full set of filters and hooks for maximum flexibility:
init_plugin_suite_view_count_should_count: control whether views should be counted for a specific postinit_plugin_suite_view_count_meta_key: change the meta key used to store view counts, per post or use caseinit_plugin_suite_view_count_api_top_args: customize the WP_Query used in the/topAPIinit_plugin_suite_view_count_api_top_item: modify the output of each item in the/topAPI responseinit_plugin_suite_view_count_api_top_cache_time: adjust the cache duration for top view resultsinit_plugin_suite_view_count_top_post_types: override the list ofpost_typeused in the/topAPIinit_plugin_suite_view_count_query_args: filter the WP_Query when using the[init_view_list]shortcodeinit_plugin_suite_view_count_empty_output: customize the HTML output when no posts are foundinit_plugin_suite_view_count_default_shortcode: change the default shortcode auto-inserted into post contentinit_plugin_suite_view_count_auto_insert_enabled: enable/disable auto-insert based on post type or context
See the full tutorial: Extending Init View Count with Filters & Hooks.
Get Started
Need a lightweight, precise, and extensible post view counter for WordPress? Init View Count is your ultimate solution.