Can I recover my views? All counters were resetted to 0 views by updating database.

6.86K viewsWordPress
0

Hello,

After we discovered that all questions/answers were gone on our website, we went to the admin in WP. WP said the Anspress database was not updated, with a button to update manually. So I did and all questions/answers reappeared, but all views were resetted to 0. Is there a way to recover these stats also? Thanks in advance!

Pleas check if wp_ap_views have rows?

Not even one I’m afraid…neither from history nor after the database update.
There are apmeta_type columns with ‘post_view’ values in wp_ap_meta. Has that anything to do with it?

Yes count of views table rows are stored in post meta for performance. One last thing, can you please show me screenshot of of wp_ap_meta table?

0

Here,
Paste this code to your functions.php and make sure to remove it after first execution

https://gist.github.com/rahularyan/a6c1d2ec641ee74f27202d0124f6cff9

commented on answer

What do you mean by run it? I put it in the functions file in the anspress plugin and saved but it was not updated. I also am missing views

Hi Rahul,
In which functions.php? In what directory? A have several functions.php’s…
Do I have to modify some database specific parameters in the code or does this code works just as it is?

Please give me one day. Adding views re-counter in options.

@Rahul:
Unfortunately, I still don’t see an option for re-counting the views. Only for votes, questions, answers, flagged posts etc…you’re still with us to solve this?

Its there in GitHub repo. Not yet published to wp.org

Paste this code in functions.php return ‘Fatal error’

I don’t think this is required anymore. This tool already added in AnsPress. Check in options.

You are viewing 1 out of 3 answers, click here to view all answers.