WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34930 closed defect (bug) (invalid)

Wordpress 4.4 - wp_title filter no longer being called

Reported by: amiga500 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

I was using 4.3.1 and using apply_filter('wp_title',...) to alter my page title. I notice that the filter never gets called after upgrading to 4.4 (on Dec 8th 2015). I decided to go into wp-includes/general-template.php and place an error_log("Hello") inside the function wp_title() at the top to see if it was ever called. No it wasn't. Huh? Some times i do see it called but it isnt consistent anymore.

Any ideas?

Change History (3)

#1 follow-up: @swissspidy
4 years ago

  • Keywords reporter-feedback added

Hi there

Which theme are you using? Did you perhaps update your theme too?

Themes are encouraged to not use wp_title() anymore but instead use add_theme_support( 'title-tag' ); (available since 4.1). See https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/ for more information.

If your theme already implements the new method, you need to use one of the new filters.

Sometimes i do see it called but it isn't consistent anymore.

That doesn't really make sense to me. Are you sure this is the case?

#2 in reply to: ↑ 1 @amiga500
4 years ago

Thanks for the info..was just looking and the problem seems to be _wp_render_title_tag(..)....it seems to have changed from 4.3 which used wp_title in the function but now uses wp_get_document_title().

I am in the process to see if there is a filter for that and then can rewrite some code to work through that instead of wp_title().

You mentioned new realted filters for my case. What are they by chance?

UPDATE:
Found the filters at the link you provided. I will begin the conversion process.
thanks

Last edited 4 years ago by amiga500 (previous) (diff)

#3 @swissspidy
4 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Yes, _wp_render_title_tag uses wp_get_document_title() under the hood since 4.4.

Glad to hear you found the filters.

Note: See TracTickets for help on using tickets.