=== WebberZone Top 10 — Popular Posts ===
Tags: popular posts, post views, page views, most viewed posts, popular posts widget, trending posts, post views counter, multisite, block, shortcode
Contributors: webberzone, ajay
Donate link: https://wzn.io/donate-wz
Stable tag: 4.3.1
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 7.4
License: GPLv2 or later

Track post views and page views, and display popular posts and trending content on your WordPress site.

== Description ==

WordPress lacks built-in page view tracking or a popular posts feature. [Top 10](https://webberzone.com/plugins/top-10/) solves this by counting views across posts, pages, and custom post types, then letting you showcase your most popular content.

Top 10 provides blocks, widgets, shortcodes, and template functions for displaying popular posts and view counts across your site. All tracking data is stored locally in your WordPress database, with no external services involved.

Top 10 includes comprehensive features such as thumbnail support, flexible display options, custom post type support, and developer-friendly extensibility. A built-in caching layer reduces server load, while AJAX-based tracking avoids page cache interference and works with most popular caching plugins.

Top 10 also exposes a powerful API with WordPress actions and filters, allowing developers to customise queries, tracking behaviour, and output rendering without modifying core plugin files.

= Features =

* **Page Counter**: Tracks hourly post views on posts, pages, and custom post types. Display counts automatically using blocks, shortcodes, or template functions
* **Popular Posts**: Display most viewed posts by total counts or within custom time periods
* **Gutenberg Support**: Dedicated “Popular Posts [Top 10]” block with configurable display options
* **Multisite Dashboard**: Network-wide aggregated statistics across all sites in a multisite installation
* **Widgets**: Sidebar widgets for daily and overall popular posts with extensive customisation
* **Shortcodes**: Use `[tptn_list]` to display popular post lists and `[tptn_views]` to show view counts
* **Thumbnails**:
	* WordPress post thumbnail support with custom `tptn_thumbnail` image size
	* Automatic extraction of the first image from post content
	* Manual thumbnail URLs via Edit Post screens
* **Exclusions**: Exclude posts by category or post ID from popular post lists
* **Styling**: Output wrapped in semantic CSS classes. Add custom CSS via settings or use included styles
* **Admin Interface**: View daily and overall popular posts from the dashboard. Adds sortable view-count columns to post and page lists
* **Export/Import**: Export count tables and settings, and restore them on the same site or other installs
* **Caching Compatibility**: Works with WP Super Cache, W3 Total Cache, Quick Cache, and similar plugins
* **Developer-Friendly**: Extensive filters and actions to customise queries, tracking behaviour, and output rendering

= Features in Top 10 Pro =

* __Enhanced Tracking and Performance__
  * __Fast and High-Traffic Trackers__: Alternative tracking methods for improved performance on busy sites
  * __Query Optimisation__: MySQL `MAX_EXECUTION_TIME` directive to prevent long-running queries, configurable via settings and the `top_ten_query_max_execution_time` filter
  * __Data Retention Override__: Customizable data retention period (default 180 days via `TOP_TEN_STORE_DATA`)

* __Advanced Blocks and Widgets__
  * __Top 10 Query Block__: Query and display popular posts directly from the block or site editor
  * __Enhanced Top 10 Featured Image Block__: Support for multiple image sources with fallbacks
  * __Popular Posts Block Enhancements__:
    * Save and clear default block settings with a single click
    * Auto-insert default and global settings attributes with an option to disable

* __Enhanced Admin Tools__
  * __Admin Bar Integration__: Admin bar menu item to view daily, total, and overall post counts, access admin pages, and clear cache
  * __Disable Admin Bar menu__: Setting to disable the Admin Bar menu
  * __Dashboard Access Control__: Setting to control which user roles can view the Top 10 dashboard
  * __Display Settings__: Setting to choose which post type screens display admin columns
  * __Mini "Top 10 Views Overview" widget__: Compact views-over-time chart on the WordPress Dashboard
  * __Multisite Settings Copy__: Tool to copy settings between sites in a multisite network

* __Custom Display Options__
  * __Taxonomy-Specific Displays__: `display_only_on_tax_ids` parameter to restrict popular post displays to specific taxonomy terms
  * __Category Inclusion__: Edit Post meta box option to include popular posts from specific categories
  * __RSS Feed Filtering__: Filter RSS feeds by category or post type via settings or URL parameters

* __WP-CLI Integration__
  * __`wp top10 counts`__: View, get, set, reset, export, and import post view counts from the command line
  * __`wp top10 db`__: Manage database tables — check status, create, update, recreate, prune old rows, force aggregation, truncate, and clean up orphaned counts
  * __`wp top10 cache`__: Flush, enable, disable, and check the status of the output cache
  * __`wp top10 settings`__: Get, set, export, and import plugin settings as JSON
  * __`wp top10 cron`__: View, enable, disable, and manually trigger the maintenance and aggregation cron jobs
  * __`wp top10 popular`__: List popular posts with counts using the same query as the front end
  * __`wp top10 status`__: Print a full plugin status overview
  * All destructive commands support `--dry-run` and `--force`; multisite commands support `--network` and `--blog-id`

* __Developer-Friendly Features__
  * __Custom Post Type Sortable Columns__: Admin columns on supported custom post types with sortable functionality

= GDPR =

Top 10 does not collect personal visitor data out of the box. Tracking data is stored locally in the `wp_top_ten` and `wp_top_ten_daily` database tables (table prefix may vary).

You are responsible for ensuring GDPR compliance on your website.

= Translations =

Top 10 is available for translation on [WordPress.org](https://translate.wordpress.org/projects/wp-plugins/top-10).  
See the [Translator Handbook](https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/) to contribute.

= Contribute =

Top 10 is developed openly on [GitHub](https://github.com/webberzone/top-10).  
Fork the project and submit pull requests for bug fixes or improvements. Please do not use GitHub for support requests.

== Other WebberZone Plugins ==

* [Contextual Related Posts](https://wordpress.org/plugins/contextual-related-posts/) – Display related posts on your WordPress site and feeds
* [Better Search](https://wordpress.org/plugins/better-search/) – Enhance WordPress search with relevance-based results
* [Knowledge Base](https://wordpress.org/plugins/knowledgebase/) – Create a knowledge base or FAQ section
* [WebberZone Snippetz](https://wordpress.org/plugins/add-to-all/) – Manage custom HTML, CSS, and JavaScript snippets
* [Auto-Close](https://wordpress.org/plugins/autoclose/) – Automatically close comments, pingbacks, and trackbacks
* [Popular Authors](https://wordpress.org/plugins/popular-authors/) – Display popular authors widgets. Addon for Top 10.
* [Followed Posts](https://wordpress.org/plugins/where-did-they-go-from-here/) – Show related posts based on reader journeys
* [WebberZone Link Warnings](https://wordpress.org/plugins/webberzone-link-warnings/) – Add accessible warnings for external links and target="_blank" links

== Screenshots ==

1. Top 10 – Popular posts overview in the WordPress admin
2. Top 10 – Popular posts list with thumbnails

== Installation ==

= WordPress install (easy way) =
1. Go to Plugins → Add New in your WordPress Admin
2. Search for “Top 10”
3. Click Install Now and then Activate

= Manual install =
1. Download the `top-10.zip` file
2. Go to Plugins → Add New → Upload Plugin
3. Upload the ZIP file and click Install Now
4. Activate the plugin
5. Configure settings under Top 10 → Settings

= Help and Support =
* [Documentation](https://webberzone.com/support/product/top-10/)
* [WordPress.org Support Forum](https://wordpress.org/support/plugin/top-10)

== Frequently Asked Questions ==

= Where can I get help and support? =

Before opening a support request, please check the following resources:

* [FAQ on the WordPress.org plugin page](https://wordpress.org/plugins/top-10/faq/)
* [FAQ on the WebberZone knowledge base](https://webberzone.com/support/product/top-10/)

These cover the most common questions and are the fastest way to get answers, as they are actively maintained.

If your question is not answered there, please create a new topic in the
[WordPress.org support forum](https://wordpress.org/support/plugin/top-10/).
This is the preferred support channel for the free plugin, and the forums are monitored regularly.

Support for products sold and distributed by WebberZone is available **only**
to users with an active, valid licence. Licensed users can request support [here](https://webberzone.com/request-support/).

= Can this plugin replace Google Analytics? =

No. Top 10 tracks page views and displays popular posts. It is not designed to replace analytics platforms.

= How does tracking work? =

Each visit is queued in a lightweight funnel table and aggregated into the count tables every five minutes by a cron job, so tracking never blocks page loads and works correctly behind page caches.

For a full explanation of tracker types, the funnel flow, and how to adjust the aggregation interval, see [Trackers in Top 10](https://webberzone.com/support/knowledgebase/trackers-in-top-10/).

= How does scheduled maintenance work? =

When enabled, Top 10 runs a scheduled task that periodically removes old entries
from the `wp_top_ten_daily` table.

Note: WordPress executes scheduled tasks on the first eligible page load.

= How can I report security bugs? =

You can report security bugs through the Patchstack Vulnerability Disclosure Program.
The Patchstack team help validate, triage and handle any security vulnerabilities.
[Report a security vulnerability.](https://patchstack.com/database/vdp/top-10)

== Changelog ==

= 4.3.1 =

*Release Date - 6 June 2026*

* Improvements:
	* Aggregation cron now runs every 2 minutes instead of 5 minutes for faster count updates.
	* Sync Funnel now shows distinct error messages for an empty funnel, a lock conflict, and database failures (including the actual database error).
	* Dashboard chart now formats large numbers with K/M abbreviations (e.g. 15,437 → 15.4K) and auto-hides overlapping bar labels.
	* "Recreate Database Tables" in Tools now also recreates the visits funnel and visits log tables.
	* [Pro] `wp top10 db recreate-tables` now accepts `--table=funnel` and `--table=log` in addition to `overall`, `daily`, and `all`.

* Fixed:
	* Sync Funnel on WordPress Playground (SQLite) incorrectly reported "another aggregation is in progress" due to unreliable SQLite detection; the `DATABASE_TYPE` constant is now checked first.
	* Uninstalling the plugin no longer throws a fatal error when attempting to drop database tables; the path to the uninstaller was resolving one level above the plugin directory.
	* "Recreate Database Tables" silently left the daily table missing due to a stale static cache in the table-installed check; all four tables are now recreated reliably.

= 4.3.0 =

*Release Date - 28 May 2026*

* [Release announcement](https://webberzone.com/announcements/top-10-v4-3-0/)

* New:
	* Buffered visit tracking: page views are queued in a funnel table and aggregated every 5 minutes, reducing write contention on busy sites.
	* [Pro] RSS/Atom feed views are now counted. Enable under Counter settings > Track feed views.
	* [Pro] Dashboard At a Glance widget now shows views for the current hour and today.
	* [Pro] Full `wp top10` WP-CLI suite: counts, database, cache, settings, cron, and popular posts commands. All destructive commands support `--dry-run` and `--force`; multisite commands support `--network` and `--blog-id`.

* Improvements:
	* Scheduled maintenance deletes old daily rows in batches to prevent timeouts on large databases.
	* New index on the daily table speeds up maintenance queries. Apply it to existing installs via Recreate Primary Key under Tools.

* Fixed:
	* Cache setting was referencing the wrong key, preventing posts from ever being cached.
	* Database version was recorded before upgrade routines ran, causing upgrades to be silently skipped on re-activation.
	* Daily queries now work on MySQL servers with ONLY_FULL_GROUP_BY enabled.
	* Posts with identical counts now display in a consistent order when paginated.
	* Daily counts now use the site's configured timezone instead of server time.
	* Dashboard "Total visits" now matches the chart total rather than summing only the top 20 posts.
	* Popular posts ordering no longer overridden by Post Types Order and similar plugins.
	* Deactivation now clears both cron jobs and sets the settings option to not autoload.
	* Removed incorrect `wpmu_drop_tables` filter that tried to drop network-wide tables on site deletion.

= 4.2.3 =

* Security:
	* Hardened Settings API and metabox output escaping.

* Improvements:
	* Updated Freemius SDK to version 2.13.1.
	* Updated Settings API assets and Tom Select handling.
	* Refreshed translations and generated assets.

* Fixes:
	* Fixed metabox screen handling when `get_current_screen()` is unavailable.
	* Fixed admin notices package tags.

= 4.2.2 =

* Modifications:
	* Taxonomy Suggest script removed from Settings API. Metabox also uses Tom Select for the lookup of the category field in CRP Pro.

* Fixes:
	* CSS improvements for left-thumbs and grid-thumbs styles.

= 4.2.1 =

* Security:
	* Fixed REST API permission checks to prevent unauthorized exposure of post passwords in edit context.

* Fixes:
	* Fixed a bug with the "Clear cache" button in the Tools page.
	* Fixed thumbnail location restrictions to properly support Grid thumbnails style in addition to Left thumbnails.
	* Improved JavaScript logic for style-based thumbnail location validation with better error handling and fallback mechanisms.

= 4.2.0 =

Release post: [https://webberzone.com/announcements/top-10-v4-2-0/](https://webberzone.com/announcements/top-10-v4-2-0/)

* New:
	* Settings wizard to guide initial configuration and review existing settings
	* Network-wide dashboard with aggregated multisite statistics
	* [Pro] High-traffic tracking mode with status validation panel
	* [Pro] Copy settings between multisite network sites
	* [Pro] Compact “Top 10 Views Overview” dashboard widget
	* [Pro] Option to disable the Admin Bar menu
	* [Pro] Maintenance setting to override data retention period

* Improvements:
	* [Pro] Improved dashboard chart bar click-through to open the Popular Posts screen filtered to that day
	* Updated Settings API to version 2.7.1
	* Improved media handler with recursion protection and more robust processing
	* Media Handler now supports the FIFU WordPress plugin for featured image detection.
	* Improved Tools page statistics display and caching
	* Wrapped Import/Export and Tools sections in postbox containers for consistent UI

* Developer / Internal:
	* Refactored popular posts queries for improved performance and WordPress VIP compatibility
	* Updated caching behaviour for dynamic exclusions
	* Refactored database operations into a dedicated Database class
	* Updated Freemius SDK to version 2.13.0

* Fixes:
	* Fixed `Top_Ten_Query` handling of the `date_query` argument
	* Fixed activation redirects on single-site installs within multisite networks
	* Fixed `exclude_current_post` behaviour when caching is enabled
	* Fixed live-edit count updates in multisite statistics

== Upgrade Notice ==

= 4.3.0 =
This release introduces buffered visit tracking with a new funnel table. Existing daily-count table indexes are updated automatically for new installs — existing sites should run "Recreate Primary Key" under Tools > Top 10 to apply the performance improvement. Pro users also get feed view tracking and a full WP-CLI command suite.