WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 21 months ago

#11314 closed enhancement (wontfix)

Attribute "Alt" on images must to be improved on editor

Reported by: metacortex Owned by: ryan
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: Database Keywords: dev-feedback
Focuses: Cc:

Description

Recently i noted a change in WP 2.9 beta about ALT attribute. At last is possible include an alternative string without touch the caption.

However, this ALT string is stored on wpdb_postmeta table; why to proceed in this way? Now WP 2.9 must to query two large tables to construct a simple image tag. On the other hand, is true the actual Alt/Caption problem must to be solved. I propose:

  • Using post_title for "title", post_content for "caption"/"description" (shared) and post_excerpt for "ALT" text. or...
  • Use the same db structure as WP 2.8.X, with the difference a new checkbox would be added for activate caption, as is shown in the image i'm attaching.

If three fields into wpbd_posts are available to this job, why to use a postmeta field to store ALT data? I don't understand the reason.

Regards.

Attachments (4)

nueva-opcion-texto-alt-wp-7.gif (5.7 KB) - added by metacortex 4 years ago.
An idea for aviod conflict between Caption and Alt elements. Note the checkbox on the right.
nueva-opcion-texto-alt-wp-5.jpg (44.1 KB) - added by metacortex 4 years ago.
Actual DB structure on WP 2.9
nueva-opcion-texto-alt-wp-6.jpg (38.9 KB) - added by metacortex 4 years ago.
Actual DB structure on WP 2.8.6
nueva-opcion-texto-alt-wp-1.jpg (38.0 KB) - added by metacortex 4 years ago.
Proposed DB structure (actual 2.8.X structure is better than this)

Download all attachments as: .zip

Change History (14)

metacortex4 years ago

An idea for aviod conflict between Caption and Alt elements. Note the checkbox on the right.

metacortex4 years ago

Actual DB structure on WP 2.9

metacortex4 years ago

Actual DB structure on WP 2.8.6

metacortex4 years ago

Proposed DB structure (actual 2.8.X structure is better than this)

comment:1 follow-up: scribu4 years ago

  • Keywords dev-feedback added; image alt alternative caption title removed
  • Milestone changed from 2.9 to 3.0

You can't store the caption and the description in the same db field. Only if we drop one or the other.

Anyway, enhancements are punted to the next major release.

comment:2 scribu4 years ago

  • Component changed from Editor to Database
  • Owner set to ryan

comment:3 in reply to: ↑ 1 metacortex4 years ago

Replying to scribu:

You can't store the caption and the description in the same db field. Only if we drop one or the other.

Anyway, enhancements are punted to the next major release.

Hi. I mentioned more than one idea. Really they're based on one question: Not all the images have caption or description (even title), but all images have ALT text, so why to use the postmeta field for store an element so extensive as this attribute?. This is illogical.

For one side there are 4 strings to store: title, alt, caption and description; for the other side there are 3 DB fields on $wpdb->posts: post_title, post_excerpt and post_content. ALT attribute is the more queried string of those four, so I do not understand why WP has to always check 2 tables ($wpbd->posts and $wpbd->postmeta) to retrieve the data, when otherwise (assigning ALT to one of those 3 DB fields) the query is limited only to $wpbd->post.

comment:4 rickybuchanan4 years ago

  • Cc ricky@… added

Is this correct:

  • Including a captionless image in a post queries just the alt and title data.
  • Including a captioned image in a post queries the caption, title and alt.
  • Viewing the attachment page queries all four fields.
  • On the admin side, working with the media manager queries all four fields.
  • Did I miss any major use cases?

If this is the case it would seem to be more sensible to store the description in the second database table, as that is in theory queried less often.

I may be wrong about the description not being included with embedded images though, in which case there's no need to change it.

comment:5 nacin4 years ago

A captionless image doesn't query the database at all, except when inserted in the editor. (That may change, of course -- introducing an image shortcode has been discussed as a way to introduce trash for media for 3.0.)

comment:6 metacortex4 years ago

  • Cc metacortex added

@rickybuchanan, once the image is included in a post (with or without caption) it don't queries nothing because has a whole static data.

comment:7 follow-up: rickybuchanan4 years ago

Of course. Please excuse my complete brain failure in writing that post, that'll teach me to comment after midnight ... so @metacortex what's the reason for wanting to change the DB structure if it's not for load reasons? I haven't noticed any failure in function (as an end user) with the current implementation.

comment:8 in reply to: ↑ 7 metacortex4 years ago

Hi @rickybuchanan,

Replying to rickybuchanan:

what's the reason for wanting to change the DB structure if it's not for load reasons? I haven't noticed any failure in function (as an end user) with the current implementation.

Sometimes is needed. E.g., I developed an image based plugin, which query all these data all time.

One thing is to place the data staticly within the content, and another thing is to store it to use it for X purpose. ;)

comment:9 scribu4 years ago

  • Milestone changed from 3.0 to Future Release

I would use post_title for both title and alt text. If not, then use post_content for both description and caption (as suggested in nueva-opcion-texto-alt-wp-1.jpg).

Either way, one of the fields would have to dissapear from the admin, since there's no point in having two fields that point to the same data.

Punting to Future Release, since we don't have a consensus on the matter.

comment:10 nacin21 months ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.