Getting current page URL when default permalink is set

If you want to display the current permalink outside The Loop, then do the following:

  • Access the global $post variable
  • get_the_permalink($post->ID)

Youf code as follows:

global $post;

echo get_the_permalink($post->ID);

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