WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. freshcreate
    Member
    Posted 1 year 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.

    http://wordpress.org/extend/plugins/user-submitted-posts/

  2. Jeff Starr
    Member
    Plugin Author

    Posted 9 months 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:

    http://php.net/manual/en/function.rand.php

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.