How to Display Entry Submissions Count for a Specific Form


Would you like to display entry submissions on your site for a specific form? The total number for form entries can be helpful if you want to display the number of users who participated in a survey or have entered a contest. This tutorial will show you how you can display your entry count using PHP.

WPForms has a class specifically for handing entries and it contains many useful helper methods.

Implementation Options

There are two options to add either of these code snippets to your site.

  1. Add a PHP snippet to your template file
  2. Create a shortcode to be used on any post, page or widget

1) PHP template

If you would like to fetch in the total of entries to display in your template or for further calculations, see the snippet below.

To apply the code to your form, replace $form_id with the ID for the form.

 * PHP code snippet to fetch entry total inside PHP template.
 * @link
wpforms()->entry->get_entries( array( 'form_id' => $form_id ), true );

2) Creating a shortcode

The custom code below creates a shortcode to display the entry count inside a post or page content. But you can also use this shortcode anywhere on your site inside a widget area as well.

 * Shortcode that displays the number of completed entries for a form.
 * Usage:  [wpforms_entry_total form_id="X"] - X is the form ID.
 * @link
 * @param  array $atts
 * @return int
function wpf_dev_form_entry_total( $atts ) {

	$args = shortcode_atts( array(
        'form_id' => ''
    ), $atts );

    if ( empty( $atts['form_id'] ) ) {

    $total = wpforms()->entry->get_entries( array( 'form_id' => $atts['form_id'] ), true );

    return absint( $total );
add_shortcode( 'wpforms_entry_total', 'wpf_dev_form_entry_total' );

Once that code is created and added to your site, you would just display a shortcode like this.

[wpforms_entry_total form_id="X"]

Just remember to replace the "X" with your form ID. If you need assistance in finding your form ID, please view this article.

And that’s all you need in order to display your entry submission count on your WPForms. Would you like to create a shortcode to display your PayPal and Stripe transactions? Take a look at our tutorial on How to Display Table of PayPal/Stripe Transaction Details.