How to Display a List of WPForms Using a Shortcode


Would you like to provide a place on your site that lists all of your WPForms by name? You may want to provide a list of forms publicly (or even privately with a password) on your site to any visitor just by adding a shortcode to that page and you can easily achieve this by adding a small PHP snippet to your site. In this tutorial, we’ll show you the snippet needed to achieve this.


To create the shortcode functionality, copy and paste this code snippet to your site.

 * Create shortcode to display all form titles in a list.
 * Basic usage: [wpforms_all_forms]
 * @link
add_shortcode( 'wpforms_all_forms', function() {
   $args = [
      'post_type' => 'wpforms',
      'post_status' => 'publish',
      'posts_per_page' => -1,
    $posts = wpforms()->form->get();
    $forms = wp_list_pluck( $posts, 'post_title' );
   return implode( '<br>', $forms );
} );

All you’ll need to do now is add [wpforms_all_forms] to any page, post, or widget area on your site to display a list of all the forms you have created with WPForms.

Add the shortcode to any post, page, or widget area to display a list of all your forms

And that’s it! You’ve now created a shortcode that you can use to display a list of all your forms created with WPForms. Would you like to also create a shortcode to display a list of entries for each form? Take a look at our tutorial on How to Display Form Entries.