User Generated Content in WordPress Made EasyBy Shaumik Daityari
There’s probably been a time when you wanted to easily enable your users to to post content on your website. Perhaps, you want to let your users submit their own testimonials. If this is something you’ve been wondering about, you’ve come to the right place. In this tutorial, we’ll walk you through the process of letting users easily add user generated content in WordPress.
There are two ways in which you can let your users add custom posts to your site. Firstly, you can let them register on your site and let them manage posts the usual way anyone would in the WordPress dashboard. A second way, is to let unregistered users add guest posts, which can be done through a plugin as explained later in this article.
Posts from New Registered Users
When you first install WordPress, you need to register the Administrator user. However, that is not the only user that can register and access your WordPress site. The core structure of WordPress allows multiple users to register in your using the built-in roles. But, this doesn’t come enabled by default. To turn on the setting to let others register on your site, go to Settings > General and check the ‘Anyone can register’ option.
From this moment onwards, a register option will appear on your WordPress login screen, which is shown below.
Alternatively, if you do not want the general public to register, just a few selected users, you can login as the Admin user and create new users yourself under Users > Add New.
Once you have enabled the registration feature, you can let your readers know by adding a widget to the sidebar. You can do that by creating a Meta widget to your sidebar. Go to Appearance > Widgets and drag the Meta widget to your sidebar, or adding a ‘Login/Register’ link manually to the sidebar to the top of the page.
Once a user registers on your website, or you manually create an account, the user will be able to log into your site. After logging in, they will be able to create, edit and publish posts and pages, depending on their user role.
In short, a Contributor can add and edit posts, but cannot publish them. Authors can add, edit and even publish their own posts. An Editor has all the capabilities of an Author, in addition to the ability to edit and publish posts of others. Here’s a list of user roles and their capabilities.
Many websites like the popular Sportskeeda use wrappers around the basic WordPress functionality, but the basic idea remains pretty simple. Users are registered as Contributors and can post their articles for moderation, which then go live when approved by an Editor.
Posts from Unregistered Users – User Submitted Posts
If you want the ability to accept guest posts or other user generated content without new users needing to register with your site, you will have to use a plugin. There are many plugins that enable users to post content to your site to be published after moderation. However, for this purpose, we’re going to use the plugin User Submitted Posts for its simplicity; it allows users to submit a post via a form, which gets added as pending posts to be moderated.
After installing and activating the plugin, you can modify its settings. To do so, go to Settings > User Submitted Posts. Once in the settings page, the overview explains how you should use the plugin. Under Options on that page, you can configure which fields you want to show to your users. You can also set pre-defined settings for incoming posts like auto publishing and attaching categories, assigned author, moderation level, email alerts, enabling the rich text editor, redirect URL and success/error messages.
Attaching the Form to a Post or Page
To display the form on any post or page, you are required to use the following shortcode at the appropriate place.
Additionally, you can use the form in a widget, but displaying such a form on every page of your website may not be a wise idea.
You can also use the following PHP code in your theme to display the form.
<?php if (function_exists('user_submitted_posts')) user_submitted_posts(); ?>
Once you’re done, this is what your form will look like.
Moderating User Submitted Posts
Once a user has added a post, you’ll then see it in the pending posts section under Posts > All Posts. You can head over to the post, edit it if you like and publish it as you see fit.
Ideally, you should assign a category and an author to all such incoming posts to make sure they’re not confused with your existing posts.
Announcing the New Feature
One drawback in this plugin is that it doesn’t come with a built-in widget. However, you can add a widget by using the shortcode attached to this plugin. To do so, go to Appearance > Widgets, and add a ‘Text’ widget with the shortcode for the form as the content of the widget and an appropriate title. You’ll be able to view the same form as a widget.
This process, however, is not efficient as it loads the form in every single page of your blog, which might affect the loading time of your site, putting more load on your server. Hence, the best way to do this might be to add the form using the shortcode in a separate page and then put the link for the page on the sidebar.
Did we help you in engaging with your users by allowing them to submit posts to your website? Are there more efficient ways of doing so? Do let us know in the comments below.