Home / Admin / Display Entry Submissions Count for a Specific Form
Duplicate Snippet

Embed Snippet on Your Site

Display Entry Submissions Count for a Specific Form

Displays how many entries a specific form has received using a shortcode.

Once this snippet is added and activated, use the shortcode on any page, post, or widget area on your site. [wpforms_entry_total form_id="FORMID"]. Replace the FORMID with the form ID you want to display the entries. If you need assistance in finding your form ID, visit https://wpforms.com/developers/how-to-locate-form-id-and-field-id/.

Visit the full tutorial for more information on the shortcode attributes. https://wpforms.com/developers/how-to-display-form-entries/.

<10
Code Preview
php
<?php
/**
 * Shortcode that displays the number of completed entries for a form.
 *
 * Usage:  [wpforms_entry_total form_id="X"] - X is the form ID.
 *
 * @link   https://wpforms.com/developers/display-entry-submissions-count-for-a-specific-form/
 */
 
function wpf_dev_form_entry_total( $atts ) {
 
    $args = shortcode_atts( array(
        'form_id' => ''
    ), $atts );
 
    if ( empty( $atts[ 'form_id' ] ) ) {
        return;
    }
 
    $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' );

Comments

Add a Comment