I need a get current page Title and Page URL in footer.php or in a wp_footer action (https://codex.wordpress.org/Plugin_API/Action_Reference/wp_footer)

What is the best way to get these values?


You should get the title by get_the_title:

$page_title = esc_html( get_the_title() );

and the link by get_permalink:

$page_link = esc_url( get_permalink() );

... and perhaps use google ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.