elementor / elementor/image-optimization-releases

Duplicate wp_options Entries from Elementor Image Optimiser

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Hi there,

I'm using the Elementor Image Optimiser plugin `(v1.6.5)` and noticed it repeatedly creates duplicate entries in the wp_options table, such as:

`image_optimizer_convert_to_format`
`image_optimizer_compression_level`
`image_optimizer_custom_sizes`

On inspection, I found the issue in:

`/modules/settings/module.php
Line 79:
add_option( self::SETTING_PREFIX . $key, $args['default'] );`

Using `add_option()` without checking for the option's existence leads to duplicate rows if this function is called repeatedly - especially if the prefix is reused.

Change this line to:

`if ( false === get_option( self::SETTING_PREFIX . $key ) ) {
add_option( self::SETTING_PREFIX . $key, $args['default'] );
}`

Or even better: use `update_option()` instead of `add_option()` — this is safer and avoids duplicate rows entirely.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.