WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 4 years ago

#4267 closed defect (bug) (fixed)

wp_list_pages using a 'the_title' on all entries

Reported by: YellowSwordfish Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.2
Component: Template Keywords:
Focuses: Cc:

Description

I have a plugin that – when a specific ‘page’ is displayed (checked by is_page and ID) a filter changes the page title using a standard add_filter on ‘the_title’.
If wp_list_pages() is being used on the sidebar, ALL page titles are getting altered in the list output.
I have just checked and this does not seem to be the case using 2.1.3
As an aside, optionally passing the post ID into 'the-title' would be useful.

Change History (20)

#1 @rob1n
9 years ago

  • Milestone changed from 2.2 to 2.2.1

#2 @rob1n
9 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from 2.2.1 to 2.4
  • Owner ryan deleted

I'm of the opinion that this is at the fault of the plugin.

#3 @westi
9 years ago

  • Milestone changed from 2.4 to 2.2.1

This is a sideeffect of the changes made to wp_list_pages to try and support what is wanted in #4004.

It shows why reusing filters all over the code for similar but not identical things in not a good idea!

filter names should relate to where there are called from not the item of data on which the operate.

#4 @rob1n
9 years ago

  • Milestone changed from 2.2.1 to 2.2.2

#5 @foolswisdom
9 years ago

  • Milestone changed from 2.2.2 to 2.2.3

#6 @coppit
9 years ago

  • Cc david@… added

Adding myself to this bug.

#7 @hakre
9 years ago

  • Summary changed from wp_list_pages using a 'the_title' on all entries to wp_list_pages using a 'the_title' on all entries my-2cents

+1 - move the filter out of wp_list_pages. good spoken westi, strong point!

#8 @foolswisdom
9 years ago

  • Milestone changed from 2.2.3 to 2.3

#9 @ryan
9 years ago

  • Milestone changed from 2.3 to 2.4

#10 @mattyrob
9 years ago

+1 more for moving the filter out of wp_list_pages or for providing a more elegant solution overall :-)

#11 @Denis-de-Bernardy
8 years ago

+1 over here as well -- the_title (or the_content, or...) are for use within the loop.

a widget_title filter would make a lot more sense.

#12 @Denis-de-Bernardy
7 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

seems invalid in wp 2.8

#13 @Denis-de-Bernardy
7 years ago

  • Milestone changed from 2.9 to 2.8

#14 @hakre
7 years ago

  • Component changed from Administration to Template
  • Keywords reporter-feedback added; wp_list_pages filter 2nd-opinion removed
  • Summary changed from wp_list_pages using a 'the_title' on all entries my-2cents to wp_list_pages using a 'the_title' on all entries

have not tested wether this is still the case with 2.8

no direct invoke of the filter 'the_title' in function wp_list_pages() in post-template.php.

it would be good to have a test-plugin. does anybody has an idea which plugin the original reporter has used?

additionally i do not know wether the filter 'the_title' is even correct in there or not. until no more feedback provided i suggest to leave this closed.

corrected the wrong title /meshame.

#15 @pembo13
4 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

#16 @pembo13
4 years ago

This is still an issue in 3.4.2. The "the_title" filter is used, and the filter has no context of when it's called. A simple change by a filter on "the_title" could have a wide scope.

#17 @pembo13
4 years ago

  • Cc pembo13 added

#18 @SergeyBiryukov
4 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from 2.8 to Awaiting Review

#19 @miqrogroove
4 years ago

My two cents, as I am chatting with pembo13: Adding an unconditional filter on the_title in version 3.4.2 with the Twenty Eleven theme will cause titles to change in the admin's list of posts, in the front end "Loop", in the menu bar, and in the sidebar list of pages. It is unclear how a plugin author could ever cleanly distinguish between the title that appears in a menu or widget vs. in the standard Loop.

#20 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 3.0
  • Resolution set to fixed
  • Status changed from reopened to closed

The original bug (not passing page ID to 'the_title' filter in Walker_Page class) was fixed in [14964] for #13558.

If a better context is still needed, please create a new ticket.

Note: See TracTickets for help on using tickets.