Opened 7 years ago
Closed 7 years ago
#1978 closed defect (bug) (fixed)
Quotes in post title make it into the title for comments_popup_link()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | high | Milestone: | 2.1 |
| Component: | Administration | Version: | 2.0 |
| Severity: | major | Keywords: | bg|has-patch bg|commit |
| Cc: | sjmurdoch |
Description
If you have a post with quotes in it, they make it into the title for the comments_popup_link() link. This makes invalid code.
Example:
Post title = Announcing "Alphabetical Plugins"
Then this code:
comments_popup_link('Comments Off', '1 Comment »', '% Comments »');
produces:
<a href="http://www.viper007bond.com/archives/2005/11/27/announcing-alphabetical-plugins/#respond" title="Comment on Announcing "Alphabetical Plugins"">Comments Off</a>
Solution: htmlspecialchars() or wp_texturize() needs to be run on the post title before it's used.
Attachments (2)
Change History (13)
Since you didn't attach the diff file yourself, I just did it for ya. Props to you for solution.
comment:2
Viper007Bond — 7 years ago
Much appreciated. :) I don't have any SVN software or anything to make a diff file with, so... :/
comment:3
Viper007Bond — 7 years ago
- Priority changed from normal to high
comment:4
Viper007Bond — 7 years ago
- Keywords bg|has-patch added
Not sure if wp_texturize() or htmlspecialchars() is the preferred thing for this BTW.
comment:6
markjaquith — 7 years ago
- Keywords bg|commit added
- Milestone set to 2.1
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
markjaquith — 7 years ago
comment:7
markjaquith — 7 years ago
My patch uses wp_specialchars()
comment:8
Viper007Bond — 7 years ago
Yeah, that's best.
When I wrote this over 3 months ago, I wasn't aware of how to create patches and the function wp_specialchars(). I was such a noob. :D
wp_specialchars needs to be called with a true second argument to actually replace quotes. Like this wp_specialchars($post->post_title, 1).
If this change is done to the patch, it works for me.
comment:10
thetorpedodog — 7 years ago
I've got a different patch on ticket #2625 that uses applying the filters for the_title. It does all the fancy quote and dash nonsense and other things applied to post_title().
comment:11
Viper007Bond — 7 years ago
- Resolution set to fixed
- Status changed from assigned to closed
Fixed via #2915 (about time!)

wraps wptexturize() around $post_title