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

Update call to post_exists to include post_type in the query #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dhusakovic
Copy link

During the post import we check whether the post already exists using post_exists.

The query currently utilises post title and date parameters, which will run through all the posts to try and find a match.

In cases where we have a large number of posts this query can time out and the import fail.

Passing the post_type to post_exists function allows us to use the type_status_date key, which significantly drops the number of rows examined and the overall query time in certain instances.

This change would also fix some edge case scenarios with posts across post types having the same title and date.

Issue link: #162

Copy link
Member

@dd32 dd32 left a comment

Choose a reason for hiding this comment

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

Per #162 this looks good to me.

The double-check on like 675 of get_post_type( $post_exists ) == $post['post_type'] should probably stay too, as it runs after a filter of this value.

@dhusakovic
Copy link
Author

Hi @dd32 thanks for approving the PR! When can we expect this change to be merged?

@rebeccahum
Copy link

@dd32 Will this make it into 6.6 you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants