Forums

Adding a filter to 'the_title' without affecting titles from wp_list_pages()? (3 posts)

  1. Trahald
    Member
    Posted 2 years ago #

    I have a filter a filter for 'the_title', e.g.:
    add_filter('the_title', 'my_title_filter');
    I'd like this to edit the title for the current page or post with a custom function - however, it seems that it also alters the titles of Pages in the navigation menus, called from wp_list_pages().

    How can I have a filter that changes the title of the current Post or Page only, without affecting the titles of other Pages?

  2. Trahald
    Member
    Posted 2 years ago #

    Does someone have any ideas on this?

  3. queenvictoria
    Member
    Posted 2 years ago #

    try checking for in_the_loop() . the page title will occur in_the_loop and the wp_list_pages() will be outside ( or should be anyway ) .

    http://wordpress.org/support/topic/283091

Topic Closed

This topic has been closed to new replies.

About this Topic