1. Home
  2. Snippets
  3. Display entry submissions count for a specific form

Display entry submissions count for a specific form

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

For extra guidance, please see WPBeginner's tutorial on adding custom code.


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 content. This number can easily calculated.

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

If you would like to fetch the total in PHP 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.

wpforms()->entry->get_entries( array( 'form_id' => $form_id ), true )

The custom code below creates a shortcode to display the entry count inside a post or page content.

 * Shortcode that displays the number of completed entries for a form.
 * Usage: [wpforms_entry_total form_id="X"] - X is the form ID.
 * @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' );
Updated on May 21, 2019

Was this article helpful?