PostViews MySQL query

Posted in: Newspaper
Post count: 115

Hi there,

need sql-query for post view count, I use this one but it’s no match with portal view count

select * from wp_postmeta where post_id = 11565 AND meta_key like ‘post_views_count’

thx

Post count: 35449

Hi,

I think that you can use something like this https://i.imgur.com/RL5f7qp.png or you can use this -> https://i.imgur.com/3BlN0WL.png SELECT * FROM wp_postmeta WHERE meta_key LIKE 'post_views_count'

Hope this will help you!
Thank you!

Post count: 115

Yes I have that code but it’s not a same as function inside WP

thx

Post count: 35449

Hi,

If you want to reset or set a number for post view counter on all post you can do it using this functions.
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.

If this is not what you need, please provide some more details.

Maybe this will help you!
Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.