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 long WP Media Folder queries #2233

Closed
3 tasks done
curtismchale opened this issue Mar 30, 2023 · 6 comments
Closed
3 tasks done

fix long WP Media Folder queries #2233

curtismchale opened this issue Mar 30, 2023 · 6 comments
Assignees

Comments

@curtismchale
Copy link
Contributor

curtismchale commented Mar 30, 2023

Source
CM

Related to the rollback of: #2231

WP Media Folder uses a very slow function called attachment_url_to_postid() here. This seems to have an adverse interaction with the usage of Open Graph as seen in this JetPack issue. The crazy long queries we saw in ELGL forced the rollback exactly match the issue above.

Either turning off OpenGraph functions in WordPress SEO or commenting out the function in question stops the long queries from showing up locally.

Solutions

Remove long function

We could remove the_content filter in WP Media Folder linked above. This function does some parse of the URL provided and determines if it's a video or not. If it's a video it wraps the URL in some extra markup for their iframe. Checking our iframe on the Beta site testing page I don't see this markup at all.

Removing this function would mean that we don't get the markup on videos.

JetPack did add a fix to their plugin which I've passed on to WP Media Folder to hopefully get a fix for this. I also noted that they don't escape the URLs provided to their iframe with esc_url() as they should.

Upon further investigation this function is new between 5.5.4 and 5.5.6 so removing it should have no impact on old content, since it doesn't exist on current sites.

  • check what the effect of hiding the button in the media gallery to add the external video is
  • does removing this function have effect on any videos like we see at https://proudcity.com/payments?
  • use remove_filter( 'the_content', 'wpmfFindImages' ) to remove this new function

Turn off OpenGraph in WordPress SEO

Turning off OpenGraph functions in WordPress SEO also removes the long queries. OpenGraph provides social media sites with metadata so that a social post has an image and a description in it automatically. Turning this off would remove those images/descriptions by default from social media posts.

I don't see anything in the recent release notes to say that WordPress SEO changed their Open Graph setup or that WP Media Folder is doing anything different either.

I suggest removing the function from WP Media Folder.

@curtismchale curtismchale self-assigned this Mar 30, 2023
curtismchale added a commit to proudcity/wp-proud-core that referenced this issue Mar 30, 2023
Issue: proudcity/wp-proudcity#2233

Removes the new function that creates a huge bottleneck on sites.
@curtismchale
Copy link
Contributor Author

@kevindherman @lukefretwell ELGL, Proudcity, and all staging sites have been running a build with the updated plugins from #2231 and the fix detailed here since yesterday morning. I monitored the database and it is running fine.

@kevindherman
Copy link

@curtismchale @lukefretwell looks good to me but PC.com isn't loading the embedded dashboard for me, tried a few times and works on ELGL and test sites I went to.

Screen Shot 2023-04-04 at 9 37 48 AM

@curtismchale
Copy link
Contributor Author

@kevindherman these updates and the dashboard are in entirely different sections of the site code so the updates should have no effect on it. I currently see the dashboard on PC.com as info but often don't see the dashboard on sites.

@kevindherman
Copy link

@curtismchale sounds good.

@kevindherman
Copy link

@curtismchale are there particulars I should be looking out for on those sites other than homepage load times and clicking around the media library?

@curtismchale
Copy link
Contributor Author

Deployed with: https://github.com/proudcity/wp-proudcity/releases/tag/2023.04.04.1105

Build: master-7430f88410852a8800e0b685f850ac1105e0678c

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

No branches or pull requests

2 participants