User Submitted Posts
[resolved] Random url number, instead of sequential (2 posts)

  1. freshcreate
    Posted 3 years ago #

    The posts are displaying as "siteurl.com/user-submitted-post-1" then 2, 3, etc.

    I'd rather site users not be aware of how many posts are being made site wide. Is there any way around this? Maybe a randomly generated string/number?

    Thanks in advance.


  2. Jeff Starr
    Plugin Author

    Posted 2 years ago #

    By default, the plugin uses built-in WP functions to create a post slug based on the submitted post title. If the title is hidden on the form, then "User Submitted Posts" will be used by default. The concern here is that WP automatically appends a number to the post slug to keep it unique. Here is a possible workaround:

    Replace this line (in user-submitted-posts.php):

    $title = 'User Submitted Post';

    ..with this:

    $title = 'User Submitted Post' . ' ' . rand();

    This is applying your suggestion to append your own random string, so that the default post titles are unique, so no need for WP to append a number. You can customize the random string as needed:


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • User Submitted Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.