<?php function remove_title_tag_on_blog_posts($title_parts) { global $template; $templateName = basename($template); if ($templateName === 'single-post.php') { $title_tag_blog_post = get_field('title_tag_blog_post'); if ($title_tag_blog_post) { $title_parts['title'] = $title_tag_blog_post; } } return $title_parts; } add_filter('document_title_parts', 'remove_title_tag_on_blog_posts', 10);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter