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

Images in plugin used with img get marked as errors #757

Open
sc0ttkclark opened this issue Oct 28, 2024 · 2 comments
Open

Images in plugin used with img get marked as errors #757

sc0ttkclark opened this issue Oct 28, 2024 · 2 comments
Labels
[Team] Performance Issues owned by Performance Team [Type] Bug An existing feature is broken

Comments

@sc0ttkclark
Copy link

Related to this sniff:

ERROR | PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | Images should be added using wp_get_attachment_image() or similar functions

The problem here is that plugins have their own <img src="<?php echo esc_url( $image_from_plugin) ); ?>" ... /> image tags output. These trigger the ERROR which seems like it should be a WARNING perhaps?

@ernilambar ernilambar added the [Team] Performance Issues owned by Performance Team label Oct 29, 2024
@ernilambar
Copy link
Member

Today, I faced same issue with following code:

<div><img src="<?php echo plugins_url( 'img/logo.png', __FILE__ ) ?>" alt="Logo" class="pe-3" /></div>

@ernilambar ernilambar added the [Type] Bug An existing feature is broken label Nov 6, 2024
@swissspidy
Copy link
Member

Sounds reasonable to make it a warning instead. PRs welcome :-)


Today, I faced same issue with following code:

Logo

Aside: you should really specify width & height attributes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Team] Performance Issues owned by Performance Team [Type] Bug An existing feature is broken
Projects
None yet
Development

No branches or pull requests

3 participants