Make WordPress Core

Opened 19 years ago

Closed 17 years ago

#1274 closed defect (bug) (wontfix)

Problem passing a 'title_li' with HTML entities to wp_list_pages()

Reported by: anonymousbugger's profile anonymousbugger Owned by: rob1n's profile rob1n
Milestone: Priority: normal
Severity: minor Version: 2.1
Component: Template Keywords: dev-feedback 2nd-opinion
Focuses: Cc:

Description

There are a problem with use of parse_str() function to parse the arguments passed to the wp_list_pages() function. If you want to write a word with HTML entities on the "title_li" argument the system cut the word at the first "&". This is really important in non english languages that uses tildes, acutes, etc.
Ex.: <?php wp_list_pages('title_li=<h2>P&aacute;ginas</h2>' ); ?>
Become: <h2>P

I put an quick&dirty hack on "Additional Information".

PS: This is my first Report so, I'm sorry if this is not the correct way to solve the issue :)

Change History (6)

#1 @anonymousbugger
19 years ago

  • Patch set to No

#2 @susez
18 years ago

  • Severity changed from minor to major
  • Version changed from 1.5.1 to 2.0.4

#3 @susez
18 years ago

  • Severity changed from major to minor

It can be solved changing the template like this:

<h2>P&aacute;ginas</h2>
<ul>
<?php wp_list_pages('title_li='); ?>
</ul>

#4 @rob1n
17 years ago

  • Keywords dev-feedback 2nd-opinion added
  • Owner changed from anonymous to rob1n
  • Status changed from new to assigned
  • Version changed from 2.0.4 to 2.1

This is more a limitation of the parse_str function, which is what PHP uses to parse the query string-style arguments. I don't know how we could fix this, except for some ugly hacks or taking it in traditional-style function arguments, but that defeats the whole purpose of using query strings in the first place.

I would recommend solving this by doing title_li= and putting the H2 seperately, as is in comment 3. But how about for other arguments that may need entities?

#5 @andy
17 years ago

rawurlencode the value that has entities. parse_str decodes internally.

#6 @markjaquith
17 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

Remember that you can also pass an array.

wp_list_pages(array('title_li' => '<h2>P&aacute;ginas</h2>'));
Note: See TracTickets for help on using tickets.