Clear post views when switching to another way of saving them

Posted in: Newspaper
Post count: 195

Hey there,

I’ve been using the native theme post view ajax count but it is causing me some trouble. We post a lot of topics and it seems that saving things in postmeta is not a good approach. We are moving to a custom way of doing this to avoid bloat.

Is there a way to properly clear currently saved data from the newspaper theme from the db without causing any issues?

Please advice me on how to do that.

Post count: 35449

Hi,
If you are referring to clearing the post view counts that are already saved in teh theme panelm then I’m afraid there is no option for this, it needs to be done manually in the database using s mysql script or usinga function in functions.php to overright all view fields and set them to 0;

I manage to make a function that can help you, you can get it from here -> https://pastebin.com/VX9Nd7zT , you need to set it in wp-content/plugins/td-composer/legacy/Newspaper/functions.php like this -> https://i.imgur.com/ZNMViNG.png after that refresh your posts and check if the view counter are set on each posts after that remove the code from function ( if not the view counter will be overwrite with 0, you can set the number you want).
Before doing anything, make sure that you have a full backup for your website and database.
Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.