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
wp-image-{ID} class for inserted attachments #1189
Comments
This is indeed a big challenge and I'm not even sure it can have an automated solution – we might require plugin authors to avoid numerical IDs in templates, CSS files etc. For example, they could use a slug. That is unpleasant but I can't see how we could automatically replace IDs with VPIDs here. The technical reason is that for database entities, VPID is their canonical identifier and in multiple environments, it can be represented by different autoincrement IDs just fine (MySQL database is a "cache" as far as VersionPress-powered site is concerned; it can be deleted at any time and restored from the Git repo). But for files, what is in the repository is exactly copied to every working copy and we cannot have |
No way to easily implement this with regex in the .versionpress files? Something like
in this case
Then you could use the VPID in vpdb files. |
@unclhos The problem is that someone might use the auto-increment ID in their CSS styles, PHP templates etc. So when we fix the ID in database entities using the VPID technique or the regex you suggest, their styling or whatever will be broken. |
Why would you do it in the database? Wouldn't you just do it to the copy stored in the vpdb files like you do the siteurl? Edit: ah, I see what you mean. Hmmmmmmm |
Well really if you do nothing. Everything will work fine in this situation. Because 128 could be abc for all we care. If they use that id to target with css, then info will be the same everywhere. The problem only problem i would see is if they deleted the html and re-inserted it on a different location, then the ID would change and css would break. But they would probably just think that was a different image. |
When image (attachment) is uploaded and inserted into post, special class
wp-image-{ID}
is automatically applied.But this
ID
will be preserved for example during restore even if no longer valid. I am not sure what should be done:But when somebody targets this
ID
in his CSS files, VP will break it.It could be automatically replaced with the help of
VPID
, but it does not solve CSS problem.It can be easily removed with get_image_tag_class hook which is probably good for new installations and new posts, but older posts have to be handled anyway.
Similar problem is also for caption shortcode.
The text was updated successfully, but these errors were encountered: