felzend
Forum Replies Created
-
Forum: Plugins
In reply to: [Top 10 - WordPress Popular posts by WebberZone] Total views doesn’t updatesHello, sorry for all the time passed.
I discovered that problem is because the plugin seems to be counting each view on the “total views” as one row, instead of using one row per post, like you can see on the following screenshot: https://i.imgur.com/POpanDR.png.
This issue was causing slow query on the WordPress, so I put an index on the table and it’s very better now.
But well, for solve this problem (since I wish to see both Total Views and Today Views on the Admin Panel and Today Views works okay) I modified the action that calls the function that runs the query to return the number of views, doing like this.
remove_action( 'manage_posts_custom_column', 'tptn_value', 10, 2 ); add_action( 'manage_posts_custom_column', [$this, 'tptn_value'], 10, 2);
And for Total Count, I changed my query for this one.
That’s not the correct way, but since the plugin is counting one view per row on “total_views” table, I needed to do this.
SELECT postnumber, SUM(cntaccess) as sum FROM {$table_name} WHERE postnumber = %d AND blog_id = %d GROUP BY postnumber
Forum: Plugins
In reply to: [Top 10 - WordPress Popular posts by WebberZone] Total views doesn’t updatesThere are screenshots below showing my settings.
The following screenshot shows the current problem. My “Today’s views” updates normally, but my “Total Views” does not. A simple case is the one below, which shows my “Total Views” (1) always one and my “Today’s views” (22) updates normally.