Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the purge caching issue when the post status is changed to draft or pending #174

Merged

Conversation

@imranhsayed
Copy link
Contributor

@imranhsayed imranhsayed commented Feb 20, 2019

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

Tested the PR. Working as described in the description.

@chandrapatel chandrapatel merged commit fccd54d into rtCamp:master Feb 25, 2019
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants