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

Consider saving json_encoded option value to wlo cpt post_content #3

Open
jtsternberg opened this issue Feb 12, 2015 · 2 comments
Open

Comments

@jtsternberg
Copy link

I think we could improve performance by cutting out the extra post-meta lookup by storing the option json_encoded to the post_content. @thomasgriffin wrote an excellent post exploring this very idea: https://thomasgriffin.io/wordpress-performance-outside-box-handling-retrieving-data/

I understand that the post_id is cached, so it's possible that there is only one lookup, so we may only be replacing a lookup in the post-meta table to a lookup in the posts table, but according to Thomas' article, that one lookup would be significantly more performant.

@prettyboymp
Copy link
Collaborator

The initial version of the plugin worked that way. However, because there are often filters that plugins will run against post content, it can sometimes mangle the data. See 66c0ebc

@jtsternberg
Copy link
Author

Oh interesting. Those filters wouldn't touch the content if you called $post->post_content directly, would they? Or did you see the filters happening when doing the wp_insert_post? Either way, serializing the data would definitely make it more brittle than json_encoding it.

Just some thoughts.

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

No branches or pull requests

2 participants