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

Plugin should not update options when viewing frontend #153

Open
kadamwhite opened this issue Sep 14, 2023 · 1 comment
Open

Plugin should not update options when viewing frontend #153

kadamwhite opened this issue Sep 14, 2023 · 1 comment

Comments

@kadamwhite
Copy link

I've observed that the recent changes to this plugin are causing an update_option call on every page view. This causes performance issues on high-traffic sites, because frontend site views cause a database write in addition to reading all of their normal content out of the database.

I'm looking at this line: https://github.com/the-events-calendar/the-events-calendar-category-colors/blob/develop/src/Category_Colors/Main.php#L247
get_category_terms is called by load_categories, which is hooked to init, which runs every time WP spins up to serve a request.

It feels like we shouldn't have to update any content on a normal frontend page view. I'd only expect an option to get written if the user has taken some action which could change the contents of the option, or possibly if a cache has expired.

@afragen
Copy link
Collaborator

afragen commented Sep 14, 2023

Interesting that the blame shows this line has been present for 9 years.

I do agree that this shouldn't happen.

FYI, I've given the plugin the The Events Calendar folks for maintenance and support. I'll still be helping where I can.

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