Get URL of Post You Are Editing

You should have the $post variable (you may need global $post;) from which you can get the post ID ($post->ID). Then $perm = get_permalink( $post->ID ); should give you what you want.

https://codex.wordpress.org/Function_Reference/get_permalink

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)