Counting views looks like to count double

Within a shortcode I like to count my page views. Every time when i count a view with a custom field, it doubles the count. It counts for 2 instead of 1.
Does someone has any idea what could be the reason and how to solve it?

function update_gelezen($postid) {
$date = date(‘Y-m-d’);
update_field(‘leesdatum’, $date, $postid);
$now = get_field(‘leesteller’,$postid);
$now = (int) $now;
$new = $now + 1;
update_field(‘leesteller’, $new, $postid);

add_shortcode(‘showportfolio’, ‘myportfolio’);
function myportfolio() {
$result = ‘’;
$query = new WP_Query(array(
‘post_type’ => ‘lscontentblock’,
‘posts_per_page’ => -1,

while ($query->have_posts()) {
$post_id = get_the_ID();
$result .= “[blahblahblah]”;
return do_shortcode($result) ;

Read more here:: Counting views looks like to count double

Leave a Reply

Your email address will not be published. Required fields are marked *