Hey there!
No idea, to be honest. I’m not familiar with AWS (I know what it is, just have never used it before).
WPP is updating the views count of the post IDS that WordPress returns. For some reason, WordPress is returning the IDs of the test site.
Maybe you should check with AWS if the steps you’re following are the right ones for your project.
Hi Hector!
I had another look after reading your post –
We have two WordPress (test & live) connected to the same database. Sometimes we’ll make some changes on the test server and then deploy that version to the live server. As they’re literally connected to the same database, I think some URLs in the database was accidentally changed to the URL of the test site, so now the WPP of the live site only count the view counts of the test site.
Basically, we only post on the live site, so the IDs are the same on the live site and the test site. I think it’s something wrong with the WP database, just wonder if you know which part we might have changed?
Cheers.
I would make sure that the URLs in the database are all changed to the one used by the live site (Google “WordPress migration queries”). Other than that I’m out of suggestions.
If the above doesn’t solve the issue, I suggest getting in touch with the AWS team and ask for their assistance.
Thanks Hector
Do you know where this URL is kept in the wordpress database? I want to take a look at it.
Do you know where this URL is kept in the wordpress database?
In several places, actually. That’s why I said: Google “WordPress migration queries” 😛
😉
I took a deeper look and couldn’t reconcile the ID issue – not sure if I stressed this fact earlier but both sites use the same database and therefore the same post IDs.
WPP is updating the views count of the post IDS that WordPress returns. For some reason, WordPress is returning the IDs of the test site.
There’s only one post ID for the same post in both sites. Clearly WordPress is only returning incorrect values to the plugin. Would you have any idea where I can take a closer look at this?
(…) not sure if I stressed this fact earlier but both sites use the same database and therefore the same post IDs.
Yes, you made it pretty much clear. You mentioned that in almost all of your comments here so far 😛
Would you have any idea where I can take a closer look at this?
I’d love to be of more help, I do, but as I already said I’m not familiar with AWS and so I have no idea what might be wrong with your setup. Hence:
I would make sure that the URLs in the database are all changed to the one used by the live site (Google “WordPress migration queries”). Other than that I’m out of suggestions.
If the above doesn’t solve the issue, I suggest getting in touch with the AWS team and ask for their assistance.
Thanks for your persistence Hector!
we find out that code in update range summary executes a query which adds value to the last_viewed attribute.
$result2 = $wpdb->query( $wpdb->prepare(
"INSERT INTO {$table}summary
(postid, pageviews, view_date, last_viewed) VALUES (%d, %d, %s, %s)
ON DUPLICATE KEY UPDATE pageviews = pageviews + %d, last_viewed = %s;",
$post_ID,
$views,
$curdate,
$now,
$views,
$now
));
However, in the database, the “wp_popularpostssummary” table does not have this attribute, but the “view_datatime” attribute. So I think this result in this SQL query could not be correctly executed and such function return False.
Database Picture
You have an old version of WPP running there. Please update the plugin to the latest version available.
It’s been over a week since OP’s last response so I’m going to assume he’s managed to fix the issue. So, I’m marking this as resolved.