Hi @ct1601
You’ve asked an excellent question!
Making sure that I’m understanding you right, you want to:
- Remove the “Page title” (or the post title for that matter) from your Title tag
- BUT you would still like to keep the site title in your title tag
Did I get this right?
The code you share removes the entire wp_head hook, which essentially removes the head section from your site, thus causing the HTML rendering to fail.
This can be done with the help of some custom coding using the wp_head hook, similar to what you’ve attempted. But rather than that, you can use an SEO Plugin such as Yoast SEO, All in One SEO Pack, or Rankmath – all of which will allow you to edit your title tags. The other way would be to make changes to your theme template (I strongly recommend using a child theme).
I found this article, which might guide you further on how to achieve this: https://www.seoptimer.com/blog/wordpress-page-title/
If you’d like some help with a code snippet to fix this, let me know. I can try and conjure something for you. 🙂