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

Projects
None yet
3 participants
@imranhsayed
Copy link
Contributor

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 permalink on post status change
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.
@mrrobot47
Copy link
Collaborator

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

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
WIP Ready for review
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.