AnsPress_Views::insert_views( string $template )

Description #

Insert view count on loading single question page.

Parameters #

  • $template
    string (Required) Template name.

Source #

File: includes/views.php

	public static function insert_views( $template ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
		if ( is_question() ) {
			// By default do not store views in ap_views table.
			if ( apply_filters( 'ap_insert_view_to_db', false ) ) {
				ap_insert_views( get_question_id(), 'question' );
			}

			// Update qameta.
			ap_update_views_count( get_question_id() );
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment