How to set a fixed length post_id (slug) in the URL?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
48 views
Good afternoon.
Now on WordPress linking structure is /%category%/%post_id%/ and the default length post_id 3 digits. How to do that would post_id was always 5 random numbers? That is, what would the URL of the article has always had kind of type www.site.com/category/12345. That is, to limit the minimal length of the slug. How to limit the maximum length found a lot of information. But the minimum is never mentioned.

UPD:
Hypothesis.
It is possible to do through wp_unique_post_slug() here about it which in turn gives the variables using page slug here is the code as I understand.
Accordingly, it is necessary to reassign this function via function.php by adding a new variable, for example post_random_slug, which is there to generate randomly (for example based on already existing function wp_generate_password(), one that generates passwords in WP, after adding it the filter by symbols, which would only the numbers were), and after to check whether there is such a slug, and if so, to conduct the re-generation, and if not, to return to wp_unique_post_slug () and in the "permanent links" to enter the structure site.ru/%category%/%post_random_slug%/ after will be added to this variable.

But unfortunately, my not a programmer. To write this cyberstacja I can't...
by | 48 views

1 Answer

0 like 0 dislike
They will not be random because this is the sequence number of the post.

As of idiocy in the database to change the autoincrement to 9999, and all of the following will have 5 digit.
Senselessly and mercilessly.

Well, or ranting to always use a slug, typed in by hand.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 14, 2019 by iborisbelov
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users