I am not sure how you removed ?p=
from the link but you can use get_shortlink
filter to override the shortlink. You can refer following article for more details.
http://www.wpbeginner.com/wp-themes/how-to-display-wordpress-shortlinks-in-your-theme/
Reference to get_shortlink
filter: https://developer.wordpress.org/reference/hooks/get_shortlink/
Can you share some more details on how you removed the ?p= from the link?