Make WordPress Core

Opened 6 years ago

Last modified 5 years ago

#44728 new defect (bug)

Quick edit for taxonomies is using filtered data

Reported by: joyously's profile joyously Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.7
Component: Taxonomy Keywords: 2nd-opinion
Focuses: administration Cc:

Description

Looks like #8146 was not fixed, or is back again.

To reproduce:

  • Add a tag with a HTML entity in the name, such as ½.
  • Use Quick Edit on the tag page or Quick Edit on the Posts page, and the special character will be shown instead of the ½.
  • If you save the tag or post, a new tag with the character is created (instead of using the one with the spelled out entity).

I'm unsure of whether the special characters should be in the slug, but my test showed it was.

Change History (4)

#1 @subrataemfluence
6 years ago

  • Component changed from General to Taxonomy
  • Focuses administration added
  • Keywords 2nd-opinion added

htmlentities() function decodes special characters to their corresponding HTML entities.
So, when I tried

$tag_name_value = htmlentities( $tag->name );

instead of

$tag_name_value = esc_attr( $tag->name );

in wp-admin/edit-tag-form.php (line no. 123), it brings up the actual database (raw) value in the field. On saving back it retains the value in database without any issue.

However, under quick-edit section, the value added to the texbox is the on-screen rendered value rather than the actual database (raw) value.

File: wp-admin/js/inline-edit-tax.js
Line no: 137

val = $('.name', rowData);
val = val.text();

If we use a hidden field in list view and put the raw value in it, and then use this in Quick-Edit title textbox, it will probably resolve the issue.

Something like:

val = $('.name-raw', rowData);
val = val.text();

This ticket was mentioned in Slack in #core by joyously. View the logs.


6 years ago

#3 @joyously
6 years ago

I think this is not just in Quick Edit.

  1. Edit a post.
  2. Add a tag with a special character. (I used test½)
  3. Update post.
  4. Go to Tags and see the new tag is there. (but quick edit does not show the entity)
  5. Go back to edit the post.
  6. Change a little something in the content and click Update.
  7. Go back to Tags and see another new tag (with the special character in the slug).

This ticket was mentioned in Slack in #core by joyously. View the logs.


5 years ago

Note: See TracTickets for help on using tickets.