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 and update "keep original publish date" snippet in the docs #1160

Merged
merged 5 commits into from
Dec 14, 2023

Conversation

leogermani
Copy link
Contributor

@leogermani leogermani commented Nov 24, 2023

Updating the docs for the publication date snippet.

  • Fixes the current snippet: The argument expected by the core API is date and not post_date. Also adding date_gmt for completion
  • Adds the counterpart snippet for Pulls

Description of the Change

Fixes one of the snippets in the docs

How to test the Change

Credits

Props @leogermani

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

Updating the docs for the publication date snippet.

The argument expected by the core API is `date` and not `post_date`. Also adding `date_gmt` for completion
@leogermani leogermani requested a review from a team as a code owner November 24, 2023 15:51
@leogermani leogermani requested review from peterwilsoncc and removed request for a team November 24, 2023 15:51
@leogermani leogermani changed the title Update snippets.md Fix and update "keep original publish date" snippet in the docs Nov 24, 2023
Copy link
Collaborator

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

Good catch but I think it's a little more complicated.

The same filter is used for both internal connections (via wp_insert_post) and external connections (via the REST API).

The forth parameter sent to the filter is the connection, so the code snippet probably needs to be conditional with an is_a() check for whether it's an internal or external push connection.

The pull post snippet looks good.

@jeffpaul jeffpaul added this to the 2.1.0 milestone Nov 28, 2023
leogermani and others added 2 commits December 13, 2023 14:30
Update snippet to account for the two types of connections
@leogermani
Copy link
Contributor Author

Thanks for the clarification @peterwilsoncc , fixed the snippet

Copy link
Collaborator

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

Thanks @leogermani

This looks good to me, I've added a bit of a nitpick. I'll commit that and merge the PR.

docs/snippets.md Outdated Show resolved Hide resolved
@peterwilsoncc peterwilsoncc merged commit ee713ae into 10up:develop Dec 14, 2023
14 of 15 checks passed
@dkotter dkotter modified the milestones: 2.1.0, 2.0.3 Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants