• I’ve installed the WordPress AMP plugin for AMP-enabled posts. There seems to be a problem with the viewcounter. When an AMP-version of a post is viewed, the viewcounter doesn’t go up. Is there some sort of script I can input in AMP-enabled posts or some other solution in order to make the viewcounter go up with 1 when the AMP-version is viewed?

    I’ve added some custom code to my functions.php which hooks into functions from the used theme, but it can’t be made to work. Any advise would be welcome. The code is as follows:

    add_action( 'amp_post_template_head', 'process_AMP_counter' );
    function process_AMP_counter() {
    global $post;
    if (class_exists( 'td_page_views' )) {
    if (td_util::get_option('tds_p_show_views') != 'hide') {
    td_page_views::update_page_views($post->ID);
    }
    }
    }

The topic ‘Views not counted on AMP-enabled posts’ is closed to new replies.