Media rename and video block break on WordPress below 6.2, although the plugin says it requires 5.5
Los mantenedores suelen responder en 1 día
@girishpanchal30 ya está trabajando en esto.
Desde el 28/10/2026.
- #1208 de @girishpanchal30 — abierto
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Description
The readme says Requires at least: 5.5, but a few features use core APIs that do not exist on older versions:
- Rename / Replace file (WP < 6.2).
Optml_Attachment_Db_Renamerbuilds every query with the%iidentifier placeholder, which$wpdb->prepare()only understands from WP 6.2. On 5.5 to 6.1,%iis left as plain text, so the SQL reaching MySQL is literallyDESCRIBE %i(a syntax error).get_columns()gets no rows, so every table is skipped andreplace()returns 0. The file and its sizes are still moved on disk, so posts keep pointing at the old file URL and the image is likely broken. No error is shown to the user. - Optimole Video Player block (WP 5.5).
render_video_player_block()callsget_block_wrapper_attributes(), added in WP 5.6. On 5.5, a connected site that renders a post with this block hitsCall to undefined function get_block_wrapper_attributes(). - Dashboard widget (WP < 6.2).
assets/src/widget/index.jsusescreateRootfrom@wordpress/element, which core only ships from WP 6.2 (React 18). On older versions the script throws and the widget stays stuck on the skeleton loader.
Also, wp_cache_flush_group() (WP 6.1) in PageProfiler/Storage/ObjectCache::delete_all() is not guarded, but nothing calls delete_all() in 4.2.17, so it has no effect today.
Expected: either raise Requires at least to 6.2 (simplest, since 1 and 3 both need it), or guard each call (for example, check $wpdb->has_cap( 'identifier_placeholders' ) and fall back to backtick-quoting the identifier, check function_exists( 'get_block_wrapper_attributes' ), and fall back to render() when createRoot is missing).
The bundled Themeisle SDK and symfony/polyfill-php80 do not raise the floor: their newer calls are guarded or polyfilled.
Step-by-step reproduction instructions
Rename (no Optimole account needed):
- On a test site, install WordPress 6.1 (
wp core download --version=6.1.7) with PHP 7.4 to 8.1, and setWP_DEBUGandWP_DEBUG_LOGto true. wp plugin install optimole-wp --version=4.2.17 --activateID=$(wp media import ./test.jpg --porcelain)thenURL=$(wp eval "echo wp_get_attachment_url($ID);")wp post create --post_status=publish --post_title="Rename test" --post_content="<img src=\"$URL\">"- In wp-admin, go to Media > Library, open the image's edit screen, enter
renamed-testin Rename attached file, and click Update. - Run
wp db query "SELECT ID FROM $(wp db prefix)posts WHERE post_content LIKE '%renamed-test%'". It returns nothing. The post still uses the old URL, the old file is gone fromuploads/, and the image is broken on the front end. debug.logshowswpdb::prepare was called incorrectly ... placeholders (0) for the number of arguments passed (1)andWordPress database error ... for query DESCRIBE %i.- Repeat on WordPress 6.2 or later. The post content is updated to
renamed-test.jpg.
Shorter check: on 6.1, wp eval 'var_dump( ( new Optml_Attachment_Db_Renamer( true ) )->replace( "<old url>", "<new url>" ) );' prints int(0) even when posts contain <old url>.
The prepare() behaviour can also be reproduced with plain PHP. This copies the 5.5 to 6.1 regex steps and gives:
WP 5.5-6.1 prepare('DESCRIBE %i', 'wp_posts')
notice : _doing_it_wrong: The query does not contain the correct number of placeholders (0) for the number of arguments passed (1).
SQL : DESCRIBE %i
Video block (WordPress 5.5, PHP 7.4): on a site connected to Optimole (the block is only registered when connected), run wp post create --post_status=publish --post_title="Video test" --post_content='<!-- wp:optimole/video-player /-->' and open the post. You get a fatal error. Without an account: wp eval 'echo ( new Optml_Video_Player() )->render_video_player_block( [], "", null );' gives the same fatal error.
Dashboard widget (WordPress 6.1): on a connected site where the widget shows, open Dashboard. The console shows createRoot is not a function. Running typeof wp.element.createRoot returns "undefined".
Screenshots, screen recording, code snippet or Help Scout ticket
- Declared floor: https://github.com/Codeinwp/optimole-wp/blob/v4.2.17/readme.txt#L4
%iqueries: https://github.com/Codeinwp/optimole-wp/blob/v4.2.17/inc/media_rename/attachment_db_renamer.php#L110-L133 (also L168-L175, L221, L234, L306-L308)
Callers: https://github.com/Codeinwp/optimole-wp/blob/v4.2.17/inc/media_rename/attachment_rename.php#L73-L106 (file moved first, then$results = $wpdb->get_results( $wpdb->prepare( 'DESCRIBE %i', $table ) );replace()), andinc/media_rename/attachment_replace.phpL205 and L245.- Video block: https://github.com/Codeinwp/optimole-wp/blob/v4.2.17/inc/video_player.php#L236-L240
return sprintf( '<div %s><optimole-video-player %s></optimole-video-player></div>', get_block_wrapper_attributes(), ... ); - Widget: https://github.com/Codeinwp/optimole-wp/blob/v4.2.17/assets/src/widget/index.js#L1-L7
- Unused: https://github.com/Codeinwp/optimole-wp/blob/v4.2.17/inc/v2/PageProfiler/Storage/ObjectCache.php#L79-L81
- Core:
%iadded in 6.2 (https://github.com/WordPress/WordPress/blob/6.2/wp-includes/class-wpdb.php#L1478). In 6.1, an unknown%iis escaped to a literal (https://github.com/WordPress/WordPress/blob/6.1/wp-includes/class-wpdb.php#L1482).get_block_wrapper_attributes()was added in 5.6 (https://github.com/WordPress/WordPress/blob/5.6/wp-includes/class-wp-block-supports.php#L160-L170).wp-includes/js/dist/element.jsexportscreateRootin 6.2 but not in 6.1.
Environment info
Optimole 4.2.17 (the same code is on master and development). Rename/Replace and the widget fail on WordPress 5.5 to 6.1. The video block fails on WordPress 5.5. Any PHP version from 7.4 that those WordPress versions support.
Is the issue you are reporting a regression
No. The same code has been there since 4.0.0, when Requires at least was already 5.5.
Found while writing the WordPress compatibility checks for Optimole.
- Lenguaje dominante
- PHP
- Estrellas
- 74
- Forks
- 14
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 31
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Codeinwp/optimole-wp
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Codeinwp/optimole-wp#1216 ·
Los mantenedores suelen responder en 1 día
-
Page profiler endpoint fatals on PHP 8 when the request has no `b` (background selectors) fieldPosiblemente ocupada @girishpanchal30 la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Codeinwp/optimole-wp#1204 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Background image with a gradient is not lazy-loaded on WordPress 7.1 (Quote, Pullquote, Verse, Post Content, Accordion)Posiblemente ocupada @girishpanchal30 la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Codeinwp/optimole-wp#1203 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Page profiler never treats the detected LCP image as LCP, so it gets no fetchpriority="high" (stored ID is a string, compared with === to an int)Posiblemente ocupada @girishpanchal30 la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Codeinwp/optimole-wp#1202 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Account sign-up fatals when the Optimole API returns an empty or non-JSON responsePosiblemente ocupada @girishpanchal30 la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Codeinwp/optimole-wp#1200 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Codeinwp/optimole-wp
Issues similares
-
good first issue level: 1 ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 94/100
BeyondITL/contentine-create#58 ·
Los mantenedores suelen responder en 1 día
-
Hand-built AdminModules URL in DisplayBackOfficeHeader.php (line 36), flagged for PrestaShop 9Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
PrestaShopCorp/ps_accounts#677 ·
-
bug webbackend
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
DOMjudge/domjudge#3886 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug]:En lang no longer has this. 'no_sales_to_display' => 'No Sales to display',Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
opensourcepos/opensourcepos#4794 ·
Los mantenedores suelen responder en 1 día
-
repo:cms
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
craftcms/cms#20235 · 1 comentario ·
Los mantenedores suelen responder en 1 día