1

I would to include a Post URL in which it calls the get permalink function of the Page URL and returns it, including it in the Post URL.

So for example: Page URL http://www.example.com/test
Then the post URL is http://www.google.com/test <- the permalink from the page URL.

I am not sure if this is possible. I have tried including the get permalink code in the URLs (http://www.google.com/<?php echo get_permalink( $post->ID ); ?>) but nothing I have tried works.

migrated from stackoverflow.com Aug 6 '17 at 11:11

This question came from our site for professional and enthusiast programmers.

1

From https://developer.wordpress.org/reference/functions/get_permalink/ :

get_permalink( int|WP_Post $post, bool $leavename = false )

Retrieves the full permalink for the current post or post ID.

[...]

Note that when used outside The Loop on a posts page (index, archive, etc.) without the ID parameter, it will return the URL of the last post in The Loop, not the permalink for the current page.

Your Answer

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