Show Form Submission Count for a Specific Form

The following code example will create a shortcode that will enable you to show the total number of submissions for any form ID.

Usage: [ws_form_submit_count id="123"]

… where 123 is the ID of your form.

The following code would typically be placed in your functions.php file or included in a code snippet.

Requires WS Form version 1.9.14 or later.

Only forms submitted when you are not logged in as an administrator are included in this number.

function ws_form_submit_count( $atts ) {
 
    // Read args
    $args = shortcode_atts( array( 'id' => '' ), $atts );
 
    // Check for ID parameter
    if ( empty( $atts[ 'id' ] ) ) { return; }
 
    // Get form ID
    $form_id = absint( $atts[ 'id' ] );

    // Return submit count 
    return wsf_form_get_count_submit( $form_id );
}

add_shortcode( 'ws_form_submit_count', 'ws_form_submit_count' );