haribo83
Member
Posted 6 months ago #
I am currently migrating a website over to wordpress and need to transfer many existing records.
To view each record on the old site you could pass the record_id in the url and retrieve the relevant content.
In wordpress I would like the permalinks to be prettier than that but would still like users to be able to retrieve posts if they pass the variable in the url.
Is this possible as i'm really struggling.
markparolisi
Member
Posted 6 months ago #
It's possible.
You can check if the URL query_var ( ex. record_id=1052 ) exists then write the query.
Lookup the value in the post_meta table to retrieve the post_id associated with it. Then you can use something like wp_get_single_post( $postid ) or update the original $wp_query object.
Check the action reference too. You may want to hook into something around or before template_redirect.