This is most likely due to difference in your theme’s support. Some themes render the title by using the wp_title
filter, some by using pre_get_document_title
. If your theme has this line in its functions.php
file:
add_theme_support('title-tag');
Then you need to use the pre_get_document_title
filter, as follows:
add_filter('pre_get_document_title', 'my_title');
function my_title() {
return 'Some title';
}
This is for the newer versions of WordPress. The old installations might be still using the legacy wp_title()
function, which you already mentioned in your question.
Related Posts:
- template_redirect and title
- What hook is executed just after wp_query has been executed?
- How can I hook into the post editor title field in order to change the HTML?
- Get all posts with a duplicate name
- Modify WordPress Page Title ()
- get_the_archive_title hook unwanted changes!
- Change Title Type
- Where can I find a list of WordPress hooks?
- Is there a save_post hook for custom post types?
- Where is the right place to register/enqueue scripts & styles
- Whats worth using add_action when we can simply use add_filter?
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Hook on trash post
- Adding onload to body
- What is the earliest possible hook for safely using `is_front_page`?
- Are hooks called synchronously?
- Send data to 3rd party api with wp_remote_post on wp_login
- How to customize the WP admin default help contents
- Hide gutenberg option blocks
- admin_post hook not called
- deactivated_plugin hook: get the name of the plugin
- Is there a hook for user activation (after they click the email confirm)?
- How to inject content after
- Setcookie works on admin but not front end
- Include category title in wp_title
- Bulk action hook for admin pages which uses WP_List_Table
- How to hook into user registration process Before user registers
- WP Admin Bar frontend issue with dashicon deregister
- A good way to add a different background image for each page?
- Searching a hook which triggers when deleting a post to get all comments
- add_action for lost_password or modify wp-login.php?action=lostpassword
- Add my own function to existing WooCommerce hook
- @wordpress/hooks use to add actions/filters within multiple plugin
- Firing a function AFTER redirect
- How can I customize the upload error message in WordPress?
- WordPress hook that gets featured image from direct URL?
- I don’t understand why I shoud use lostpassword_url hook?
- Hook any php file into the wordpress api
- Why is save_post hook being called twice despite all my efforts?
- Help to change the text for new website notification (wpmu_welcome_notification)
- Add parameter (time) to oembed
- How to remove query string from current page URL?
- Event-Driven Pattern vs MVC?
- Using hooks with extra parameters
- How to catch and modify custom field values when a page is updated
- Plugins rewrite rules the right way
- Strange behaviour with add_{$meta_type}_metadata | add_post_metadata filter
- Best action hook for placing ical requests
- `rest_user_query` can’t access post author in post edit screen
- Add nofollow to custom widget posts
- Change Password Confirmed Email Text
- How to Change The Title in WordPress For SEO
- Register form: add custom field BEFORE default fields
- Custom Front End Registration – How Does the Key work in the Password Set Request?
- Lock user information once fields have been filled in
- Replace text in the Title
- Keep Title and Description always
- Remove Permalink From Admin Edit Post
- How to distinguish on hook profile_update user registering, user resetting password or user updating profile?
- save_post hook to add terms getting deleted when using bulk edit
- Embeding style into the header via the function.php
- Add Different Actions To Different Page’s wp_footer
- How to execute a hook asynchronously?
- Getting the post ID in parse_query
- Issues with if, else, and elseif statements
- Remove genesis_404 hook from genesis_loop [closed]
- What hooks do I need to hook into to capture ever wp_user creation/change?
- Neccessary to call add_submenu_page and add_menu_page from admin_menu hook?
- Need help with page title (Static front page)
- “Seen by” Feature in posts [closed]
- Adding custom Bulk Actions
- What hook to use to redirect based on $post
- How to call do_action() to pass arguments to hooked functions that take different number of args?
- Is it likely that do_action will have unexpected results?
- How to export category name and category link in wordpress json
- Error later wordpress 5.3.2 update. Please help
- How to abort a save operation with a WordPress hook?
- is_page not triggering
- admin_post_(action) hook create console log error
- Check if front page within function passed to action
- I have dynamic title tag in my wordpress but seo analyst show “No title Tag found error”?
- Hook after creating a post and retrieve infos from this post immediatly
- $new_pass always returns null – password_reset hook
- How to resolve 500 error in post listing page?
- Display tab title as ‘blog tagline | blog title’
- Object oriented programming, add_action in constructor not firing
- Get new (not old) post inside transition_post_status hook
- How to Show Different Information to your authors/contributers
- Cannot override hooks.php
- Removing action from template class
- Remove “enqueued” script from array
- Function is Missing an Action Hook
- How to access variables in the function where apply_filters() is called?
- PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered
- change position of element using hook [closed]
- The acction hook stop working if i move it from plugin file to theme’s functions.php file
- wp_footer content appearing in admin area
- getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
- Callback API for getting response from fygaro payment gateway
- Changing login url