Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#56677 closed enhancement (invalid)

Allow hyphens in post tags

Reported by: cewebdesignmunchen's profile cewebdesignmunchen Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

Please allow Soft Hyphens to be used in Post-Tags (for a Tag-Cloud etc.).
Examples:
loooooooooong­keywoooooooooord
loooooooooong­keywoooooooooord

Change History (6)

#1 @sajjad67
3 years ago

@cewebdesignmunchen Welcome to the WordPress Trac. You are more than welcome!! But i am afraid, your enhancement idea is not clear. Would you please elaborate with some more examples?

#2 @cewebdesignmunchen
3 years ago

Thank you for commenting.

How to reproduce:

Create a tag (Posts->Tags) with a long word with a soft hyphen (­).
Example: loooooooooong­keywoooooooooord

Expected Result: Long Word will break at the soft hyphen.

Actual Result: Soft hyphen is filtered. Long Word will not break at the desired point.

In case more information is required, please describe what exactly is not clear enough.

Best Regards,
Chris

#3 @sajjad67
3 years ago

  • Keywords close added
  • Resolution set to invalid
  • Status changed from new to closed

The purpose of soft hyphen (SHY) is understood, but the name of a tag, how could it be break at? like what is the expected thing you are looking for? You want to go the keywoooooooooord at new line? It is not preserve / filtered cause SHY is an HTML! If you look at wp_insert_term() function which calls sanitize_term() and eventually lands on sanitize_term_field(), it needs to be escaped! A Term name should not be formatted!! It has to be only valid names... a soft hyphen doesn't seem to be a valid name for a Term!

#4 @cewebdesignmunchen
3 years ago

Yes, I want keywoooooooooord to go at a new line.

loooooooooong­keywoooooooooord should break exactly at the soft hyphen when it is too long for responsive webdesign.

loooooooooongkeywoooooooooord for desktop.

loooooooooong-
keywoooooooooord for mobil.

Please allow HTML 'SHY' for Posts->Tags like it is allowed for Posts->Titles and Pages->Titles.

A Tag name does not have to be a TERM name, does it?

Best regards,
Chris

Last edited 3 years ago by cewebdesignmunchen (previous) (diff)

#5 follow-up: @desrosj
2 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted

I agree that this should be closed as a wontfix. Instead of hard coding a hyphen character into the tag/term name, this should be managed using CSS and the hyphens property (documentation).

Depending on the context where a term is being displayed (within a narrow sidebar, below a post title in a full-width layout, etc.) combined with other design related factors (font size, weight, face, etc.), where a word should be hyphenated will vary greatly. Using hyphen: auto will allow the browser to make it's own dynamic determinations as to where a word should be fhyphenated.

hyphen: auto will also use factors relevant to the locale specified in the lang HTML attribute to determine the best places for words to be hyphenated, which makes it a better approach for non-English websites.

#6 in reply to: ↑ 5 @cewebdesignmunchen
2 years ago

hyphen: auto
browser compatibility is poor: https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens#browser_compatibility

loooooooooongkeywoooooooooord will break anywhere:

loooooooooongke-
ywoooooooooord

Might be the best solution in the far future, but no solution for non-English websites at the time being...

Note: See TracTickets for help on using tickets.