Hi,
You can do that per post, in the custom fields section of the post edit screen
– http://prntscr.com/mty4wo
Change it to the value you want and update the field.
Thanks
We have about 4,000 posts. We are migrating from another site. We need to massively change the number of views for all 4000 posts.
Is there any solution how to do it quickly? Plugin? Maybe make it through the database? In which file can this be found and what is the name of the field?
Make sure that you have enabled the Custom Field from Screen option from here -> https://www.screencast.com/t/qG2OoOCv and then, go to the bottom of the page, at custom fields section and make this change from there -> https://www.screencast.com/t/azFZQGE7
Setting a view count value for all the posts at once would be possible. For example using this function – https://pastebin.com/pKcWYFUt
The value can be changed, I set it to 1000. Enter it in the theme functions file. Refresh a post page and check if the views were updated. Then remove the function and the view should increase from the set value.
Good day.
I did everything according to the instructions. But after making changes to the theme function file, the site stopped opening (error 502). Then I replaced the old function file. Now the site opens, the number of views from the records is necessary.
Questions:
1. Is it normal that the site gave an error 502?
2. Will there be consequences for such actions? Could this function make any other changes to other files or posts (of site), and as a result, errors could come out somewhere?
Thanks.
Hi,
@denisvs I tested this again, works fine for me. That code can be entered in the functions file, at the end – http://prntscr.com/n30mul
Before the code – http://prntscr.com/n30n66
After the code – http://prntscr.com/n30ncd
Copy it as it is and paste it in the functions file at the end, shouldn’t create any problems. This code will just update the post view count for all posts, to a specified value.
The 502 error could be shown in these cases – https://www.wpbeginner.com/wp-tutorials/how-to-fix-the-502-bad-gateway-error-in-wordpress/
Maybe it was just a coincidence.
Thanks
Shouldn’t be any, after entering it check if the post views have been updated, then remove the code. All the post will have the view count set in the code (you can change that as you wish).
By default you can only set a custom view count by editing each post and entering the value in the custom fields section, not all of them at once. But this code should do it.
