Latest TweetsGreat crontab resource:
Perishable Press

FAQs for User Submitted Posts

This post contains overflow FAQs for the free version of User Submitted Posts (hosted at I am moving a bunch of the FAQs to this post in order to clean up the plugin’s ever-growing readme.txt file. For FAQs about the Pro version of USP, check out USP Pro – FAQs & Presales over at Plugin Planet. And so without further ado..

Note that these FAQs are in no particular order..

Is it possible to set up conditional redirects?

I haven’t tried it myself, but it might be possible. In the form code, there is a hidden input that specifies the redirect URL. The hidden input has a name attribute with a value of redirect-override. So you could target this input with some JavaScript, and then change the value of the hidden field based on whatever criteria you need.

What is the plugin setting for the “From” email header?

That setting enables you to customize the address used as the “From” header for email messages. If your email address is a domain-based address, then this setting should be the same as the previous Email setting. Otherwise, if you are using a 3rd-party email service, this setting should be a local, domain-based address. If you find that email messages are getting sent to the spam bin, this setting may help.

How can I display the form again after the user has successfully submitted a post?

Follow the steps to create a custom form, but use submission-form-alt.php instead of submission-form.php. Note the alternate form template still needs a way to clear cookies after successful form submission, so not recommended for public sites.

Does USP require the functions exec(), exec.php, or url_fopen?

Nope. User Submitted Posts does not use any of those functions.

Why doesn’t the USP shortcode work when added to the WP Text widget?

By default, WordPress does not enable shortcodes in widgets. I have added a plugin setting called “Enable Shortcodes” that will enable any/all shortcodes to work in widgets. Enable that setting and you should be good to go.

Note: the “Enable Shortcodes” setting applies to all shortcodes, even those of other plugins. Check out WP-Mix for more information on enabling shortcodes in widgets.

My form has lots of extra spacing between each field, how to fix?

There are numerous reasons why a form might be displayed with too much spacing between the fields. Here are some possible things to look at:

  • The USP shortcode may be wrapped with <code> tags; solution: remove the code tags.
  • Theme CSS may be interfering with its own styles; solution: examine theme styles and edit as needed.
  • There may be interference from some other plugin/theme; solution: troubleshoot your plugins and themes (check out the sections on troubleshooting plugins and themes).

The Name and URL fields are not displayed in the form, even though they are set to display in the plugin options.

The setting “Registered Username” when enabled will automatically hide the Name field. Likewise the setting “User Profile URL” when enabled will automatically hide the URL field. Try enabling these settings, logging out of WordPress, and then refreshing the form page.

How do I display success and error messages when the “Redirect URL” setting is enabled?

Add the following template tag in your theme template, wherever you want to display the success/error messages:

<?php echo usp_redirect_message(); ?>

You can then style the output via the following selectors:

.usp-error {}
#usp-error-message {}
#usp-success-message {}

Check out more CSS hooks for User Submitted Posts.

Nothing happens when you click on the “Add another image” link.

The “Add another image” link is dependent on the required JavaScript being included in the page. Check the plugin setting to “Include JavaScript?” and you should be good to go. Also make sure that the “Image Uploads” settings are configured to allow multiple files.

The height of my form fields are all messed up, how to fix?

USP provides its own, very minimal styles. Nothing that sets the height for any form fields. So if your field heights look weird, most likely your theme or a plugin is adding its own CSS styles. To resolve, you can try adding this bit of CSS to your stylesheet:

#usp_form .usp-input, #usp_form .usp-select, #usp_form .usp-textarea, #usp_form .usp-submit { height: initial; }

That line basically resets the height property of all form fields to the original value. So it should override any other height styles.

How can I customize the login-required message and URL?

When the setting “Require User Login” is enabled, and the user is not logged in, they will see a message that says, “Please log in to submit content!”. To customize this, add the following code to your theme’s functions.php file:

function usp_customize_login_required_message($message) {
	return '<p>Please <a href="">register</a> to submit content.</p>';
add_filter('usp_require_login', 'usp_customize_login_required_message');

Then customize the return line however is desired. This trick uses USP’s filter hook, usp_require_login.

To also customize the URL that is used for the “log in” link, add this code:

function usp_require_login_url($url) {
	$url = ''; // edit this to whatever you want
	return $url;
add_filter('usp_require_login_url', 'usp_require_login_url');

The only thing you need to edit is the value of the $url variable. Change it to whatever URL you would like to use for the “log in” link.

How can I change the default Post Title?

When the Post Title field is not included in the submission form, USP automatically uses the default: “User Submitted Post”. To customize the default Post Title, you can use the provided USP filter hook, usp_default_title. Here is an example:

function usp_customize_default_title($title, $time) {
	return $title .' - '. $time;
add_filter('usp_default_title', 'usp_customize_default_title', 10, 2);

That will append a unique date/time string to the default Post Title.

I’m new to WordPress and just installed USP. How do I display the form?

To add the form via shortcode, you can visit the Post or Page on which you would like to display the form, and then paste the shortcode into place. Remember to save your changes.

To add the form via template tag, it really depends on the theme, because each theme tends to use template files differently. It also depends on where on the page you would like to display the form, for example the sidebar (sidebar.php), the footer (footer.php), and so forth. Also, chances are that you’ll need to add the form to more than one template file, for example index.php and page.php, etc. A good first place to try would be the sidebar, or maybe index.php and then go from there.

How do I display the submitted Author Name and Author URL instead of the Default Assigned Author?

This functionality is built in to the Pro version of USP, but it’s also possible using either of the following methods:

  • Replace your theme’s current author tags with USP’s usp_author_link()
  • Add some custom code to your theme’s functions.php file. If interested, please contact me directly, and I will send the code and steps to implement.


In the latest version of USP (free), the author is replaced automatically (unless you disable via the settings). And for the author URL, you can add the following code:

function usp_replace_author_link($link, $author_id, $author_nicename) {
	global $post;
	if (is_object($post)) {
		$is_submission = get_post_meta($post->ID, 'is_submission', true);
		$usp_url       = get_post_meta($post->ID, 'user_submit_url', true);
		if ($is_submission && !empty($usp_url)) return $usp_url;
	return $link;
add_filter('author_link', 'usp_replace_author_link', 10, 3);

That can be added directly to your theme’s functions.php file, or added via simple plugin. No modifications required.

How do I remove the appended number from submitted image file names?

By default, USP appends a “dash-number” to the name of each submitted image. To prevent this, you can add the following code to your theme functions.php or add via custom plugin:

function usp_customize_filename_append($append) {
	return '';
add_filter('usp_filename_append', 'usp_customize_filename_append');

No modifications are required; simply add and done.

How do I customize the names of uploaded images?

Here is some code that you can add to your theme functions.php or add via custom plugin:

function usp_customize_attachment_data($attachment) {
		$attachment includes:
		array(5) {
		  string(10) "image/jpeg"
		  string(13) "example.jpg"
		  string(13) "example.jpg"
		  string(7) "inherit"
		  string(67) ""
	// do your thing..
	return $attachment;
add_filter('usp_insert_attachment_data', 'usp_customize_attachment_data');

This code snippet enables you to intercept the image filename before the image is added to the WP Media Library. So you can customize the name however is desired.

How can I customize/change uploaded file names?

USP provides numerous filter hooks for modifying the names of uploaded files. Here is an example that shows how to do this using the powerful usp_file_name hook:

function usp_file_name($file_name, $filename, $append, $ext) {
		$file_name = return value
		$filename  = root file name
		$append    = appended number
		$ext       = file extension
	// make any modifications and then return the full file name below
	return $file_name;
add_filter('usp_file_name', 'usp_file_name', 10, 4);

The hook passes several useful parameters, giving you complete control over file names.

I need help doing basic troubleshooting, can you provide any resources?

Yes, check out these tutorials:

For troubleshooting plugins and themes, check out the first tutorial sections on “Plugins” and “Themes”.

More FAQs & Infos

For more USP FAQs (for the free version of the plugin), visit the User Submitted Posts homepage at For FAQs about the Pro version of USP, check out USP Pro – FAQs & Presales over at Plugin Planet.

Questions? Feedback?

Send any questions or feedback via my contact form, and I’ll get back to you asap. Thanks! :)

Jeff Starr
About the Author Jeff Starr = Web Developer. Book Author. Secretly Important.
[ Comments are closed for this post ]