-
Notifications
You must be signed in to change notification settings - Fork 9
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
4.7.0 introduced a slow query from avatar alt text, Add option to filter avatar alt #1923
Comments
…-slow-query-from-avatar-alt-text-Add-option-to-filter-avatar-alt fix/#1923-470-introduced-a-slow-query-from-avatar-alt-text-Add-option-to-filter-avatar-alt
Hi @c0ntax, Thanks for your report. Right now, we're using So, we introduced a filter in the coming release with information here. You can use the filter and simply return "Avatar" or empty string "" or any non null value to prevent the function from querying for avatar alt. Thanks |
…-slow-query-from-avatar-alt-text-Add-option-to-filter-avatar-alt Fix null check
@ojopaul you sir, are a star! Thanks so much! |
Expected Behavior
When displaying a post with an author's custom avatar, the code to generate the page should be performant
Current Behavior
get_custom_avatar()
now usesattachment_url_to_postid()
. This function searches the postmeta table by both meta_key and meta_value. Meta_value() cannot be indexed because it's a longtext so you end up with an inefficient query that can run on a page multiple times. It was adding anywhere between 0.8s and 1.5s to every page that displayed an author on my site.Possible Solution
Steps to Reproduce (for bugs)
Context
I just want an author with a custom avatar on a page.
Your Environment
The text was updated successfully, but these errors were encountered: