dfactoryplugins / post-views-counter

Post Views Counter
56 stars 20 forks source link

Increase views if attachment embedded within content #43

Open mrgrt opened 3 years ago

mrgrt commented 3 years ago

Hi,

Thanks for the great plugin! I have an issue where I'd like to increase the views of embedded media within my post content.

I'm using the pvc_view_post function to increase the view count but it's increasing the views every time I refresh the page content. How do I increase the view only once so it behaves the same way as viewing the attachment directly and only increases the view once (so multiple refreshes don't keep increasing the view count).

Thanks!

mrgrt commented 3 years ago

Doing a little digging, it looks like the pvc_visits cookie is not being set when I call the pvc_view_post function.

mrgrt commented 3 years ago

Looks like the issue may be the following:

Cannot modify header information - headers already sent by (output started at /var/www/wordpress/wp-includes/class.wp-styles.php:214) in /var/www/wordpress/wp-content/plugins/post-views-counter/includes/counter.php on line 379