WordPress – WP Post Views Counter plugin – import data from Yuzo Related Posts How to import the view count data of each existing post from Yuzo Related Posts to WP Post Views Counter WordPress Plugin

How to automatically set File System Permissions for a WordPress Web Server with a BASH Script

Today a friend asked me to uninstall the Yuzo Related Post plugin from her WordPress blog because she want to switch to the Jetpack built-in “related posts” feature. She could perform the task by herself, but she also wanted to keep the post view counters for all their posts – an additional feature provided by Yuzo – which would be lost otherwise.

She found a great replacement plugin to handle the post view counting task: the awesome WP Post Views Counter: however, the new plugin doesn’t have a built-in feature to import the data collected by Yuzo.

That’s why she called me, hoping that I could be help her with such importing/transfering feature.

The first thing I did was comparing the two tables used by the plugins to host their data.

The Yuzo Related Posts table is called wp_yuzoviews and has the following structure:

IDint (11)NOT NULL
post_idint(15)NOT NULL
viewsint(14)NOT NULL
last_vieweddatetimeNOT NULL

The WP Post Views table is called wp_post_views and has the following structure:

idbigint (20)NOT NULL
typetinyint(1)NOT NULL
periodvarchar(8)NOT NULL
countbigint(20)NOT NULL

The main differences between the two approaches is that Yuzo Related Posts hosts a single record per post/page, while WP Post Views creates 4 records per post, each one with a different type: each record type hosts a dedicated counter so that the plugin can keep track of each post’s views for each and every day, month, year and, of course, the overall total.

Unfortunately, as we can clearly see, there’s no way to import all these detailed data from the Yuzo table, since it only keep track of the total views. The only thing I could do was transfer the total post data with the following query:

Once done, all the usable data collected by Yuzo could be also seen by WP Post Views.


About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.