Skip to content

Conversation

@imranhsayed
Copy link
Contributor

I have fixed the purge caching issue when the post status is changed to draft or pending.
I have used get_sample_permalink() to fix this issue because the get_permalink() returns URL something like https://example.com?p=6 and we need full permalink something like https://example.com/post-slug/

The get_permalink() function returns full permalink for the published post only. I explored WordPress codebase and found get_sample_permalink() which returns an array containing the sample permalink with a placeholder for the post name, and the post name.

Fixes #170

Get the permalink using get_sample_permalink() on post status other than publish. Use get_permalink() when post status is publish. The reason why we use get_sample_permalink(0, because get_permalink() does not return pretty permalink for draft or pending posts.
Copy link
Member

@mrrobot47 mrrobot47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the PR. Working as described in the description.

@chandrapatel chandrapatel merged commit fccd54d into rtCamp:master Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants