I am new to Wordpress and wondering what the best way might be to go about doing this. We have a requirement to map our own id (known as friendly_id) to the Wordpress's post id. The idea is to import a post in a different format to Wordpress so it can be edited in Wordpress. This is all on the backend.

So, lets say if a wp-admin post url comes in as http://example.test/wp-admin/post.php?friendly_id=5&action=edit

I would like to map this to


  1. Is there a Wordpress hook that might be suited to achieve this? I have tried looking into pre_get_posts, query_vars hooks without much luck.
  2. I am thinking of storing the mapping of friendly_id to post_id in the mysql database. If there is such a hook, can it access the database to retrieve this mapping?

Thanks in advance.

  • Where does friendly_id come from and what does it represent? What's the reason behind the requirement? Does a post with that ID exist? Or are you trying to create a fake post so that you can use the post editor on something that isn't a post? Is friendly_id the row ID of a custom table? Edit your question to include as much information as you can, any context you can provide will be super helpful ( even if you think it is irrelevant ) – Tom J Nowell Feb 17 at 12:45
  • @TomJNowell - I have edited the question a bit. But the idea is that we are going to use Wordpress as our editor going forward. So we need to convert posts that are currently in a different format and referenced by friendly_id to posts that can be imported and then edited in Wordpress. The mapping table will help determine if the post is already in Wordpress and hence if the url can be changed as described above. – Binita Mehta Feb 17 at 12:49
  • 1
    Wouldn't it be easier to write a conversion script that went through every row in the custom table and created normal WordPress posts? Then you could run it once, delete the table and everything would work normally? – Tom J Nowell Feb 17 at 13:00

Your Answer


Browse other questions tagged or ask your own question.