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

optimises a call to fetch all post meta in the duplication code #1503

Closed
wants to merge 1 commit into from

Conversation

tomjn
Copy link
Contributor

@tomjn tomjn commented May 21, 2018

Changes proposed in this Pull Request:

  • This swaps out an SQL query for get_post_meta with a single argument

This should simplify the code, and improve performance via WP_Cache. The biggest improvements are likely to be seen when a persistent object cache is available

Testing instructions:

  • duplicate listings

Proposed changelog entry for your changes:

  • Optimisations to listing duplication

Copy link
Member

@jom jom left a comment

Choose a reason for hiding this comment

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

As is, this breaks duplication functionality. I think this is because get_post_meta() returns values in an array and we treat these as unique (so just want the first one, if it exists).

In this example, post_id = 1277 is the duplicate and has its value set as a serialized array.
screen shot 2018-09-07 at 1 00 29 pm

My other concern is about plugin interactions with filters in get_metadata(), such as get_{$meta_type}_metadata. I'm not sure if WPML or other plugins that do things with metadata in view would prevent us from getting the raw value.

@jom jom closed this Nov 27, 2018
@jom jom deleted the meta_call_optimise branch December 11, 2018 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants