I just converted to WordPress and want to keep the same format of my old site, which includes an ‘article id’ in the url. The article id is just a random number and unique number that’s created once the article is posted. Of course, I already know what code to use. I need to know where to put the code. Please be specific. Also, since I will use this in the post’s url, how would I go about doing that in the Permalinks section?
Why not just use the post’s id instead? Seems a lot easier than making your own random number…plus there’s a x% chance of the number being repeated, where x is the number of existing posts…if you use a number between 1 and 100, that is.
mildlyhotpepper, thanks, but I don’t want to use the post_id. I want links to have the same format as links that were created before I installed WP. My old blog script that I made checks for duplicates, so the random number is not an issue. Someone who knows what they’re doing should just be able to tell me where the code goes. I’m still looking for a solution. Thanks.
you have what three threads going, all for the same purpose?
Ive answered your question in one of the other threads. If you want to assign random post_ids then you need to modify the query responsible for inserting the post into the database.
Its not assigned until the post is created, and its not assigned as a function of wordpress. Common sense would tell you that assigning a # to something and then expecting that same # to be available BEFORE the application has actually looked in the database would not work.
In other words, the post_id is a result of the insertion of the post into my_sql.
if you look at whats going on on the create new post page, you will notice this:
If you want to assign random post_ids then you need to modify the query responsible for inserting the post into the database.
If you would actually read my question, you will realize that is what I am asking for. I was quite clear, but maybe there’s a language barrier. Don’t bother offering more ‘help,’ because you’re just wasting my time when your only solution is to repeat my question.
I am still looking for a *working* solution. If someone actually knows what they’re doing, please let me know. Thanks.