Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Hide H1 Title using the_title filter

Depending on the way your theme uses the_title, hooking into the the_title filter may or may not hide the title h1. What theme are you using?

The the_title filter passes two arguments: the title (string) and the post ID. Therefore, treating the title as an array (it looks like you’re assuming $title is an array of post data, trying to set $title['post_title']. To have the_title return an empty string if the custom field “hide_title” is not empty, the following would suffice:

add_filter( 'the_title', 'wpse145940_hide_hidden_title', 10, 2 );

function wpse145940_hide_hidden_title( $title, $postid ) {
    if ( get_post_meta( $postid, 'hide_title', true ) ) {
        $title="";
    }

    return $title;
}

Related Posts:

  1. WP action/filter to modify title before header output and article output?
  2. Modify WordPress Page Title ()
  3. Anyway to edit the titlebar of WordPress Widgets in the Admin area?
  4. Strip $before & $after strings from a page title
  5. Filter the title to only affect the_title() template function
  6. get_the_archive_title hook unwanted changes!
  7. Auto append text after the title?
  8. How many filter/action hooks are healthy?
  9. How to use update_{$meta_type}_metadata filter to modify meta value
  10. Filter specific shortcode output?
  11. Earliest hook to reliably get $post/$posts
  12. What does (10, 2) mean when used with add_filter
  13. Clarification on filters and hooks
  14. Valid characters for actions, hooks and filters
  15. How to hook into unregistering a widget instance?
  16. How to check if a hook is hooked or not?
  17. Passing Additional Parameters to add_filter Callable
  18. Modify WordPress Rest Api Request/Response
  19. How to add some custom HTML into wordpress admin bar?
  20. Custom theme hooks / filters – passing arguments
  21. Remove “Private” + “:” in title does not work
  22. How to disable all WordPress emails modularly and programatically?
  23. How to hook wp_list_pages?
  24. Don’t replace “|” with Empty String (“”) when generating slugs from title
  25. How to use the_excerpt in a filter hook?
  26. Hook into admin post list page
  27. Alter only the page title, not the post titles within
  28. Change text of Description in Image Library
  29. Load different template file when condition met?
  30. Am I using the right hook for removing quicktags on the admin TinyMCE?
  31. About Hooks and Filters
  32. Changing document title only on a custom page template
  33. Should I use add_action(‘publish_post or add_filter(‘publish_post?
  34. Filter all html output
  35. Add a Span Around a Product Title in WooCommerce [closed]
  36. Too many actions/filters!
  37. How to get list of all hooks of current theme / plugin?
  38. Which hook is fired when inserting media into a post
  39. How to filter into post meta data before saving
  40. Change WordPress RSS link with filter?
  41. Filter list by a unique meta value dilemma
  42. How to remove get_post_metadata using remove_filter inside a class?
  43. add_filter() function misunderstanding
  44. Is it possible to track down Actions and Filters?
  45. Filter get_the_title to remove certain characters?
  46. get_title without filter(the_title)
  47. Filter or Hook to catch pre-rendering of post content
  48. Sorting and limitation with pre_get_posts
  49. Can the wp_filter object hold multiple values with the same key
  50. check to see if hook is available
  51. apply_filters/do_action tag characters limit
  52. How do I hide the current page’s title?
  53. How to modify core when there is no hook?
  54. Post Content, Special Characters and Filters
  55. How to filter for user registration, be able to throw error message
  56. How to remove action with slashes and arrows?
  57. Better extend a class or use add filter/action hooks?
  58. Add content as soon starts
  59. Access get_the_title() from ‘excerpt_length’ filter
  60. Changing WordPress core without hacking core
  61. Customize title, description and focused keyword [closed]
  62. Comment search plugin
  63. Plugin options, presets and filters : can you help me improve my workflow?
  64. how to customize rss feed tags using hooks?
  65. Filtering the post list in the admin area
  66. How can I replace an oEmbed URL in post with actual embed HTML
  67. Detect when gutenberg editor title is available in Dom after editor load
  68. Is it possible to bind a function to a filter hook via Ajax?
  69. How do I hook my function to run only after submitting login form
  70. Prepending character(s) to a custom tag title?
  71. Modify existing plugin function with add_filter
  72. Filter posts by meta data using custom query
  73. Remove tags without a specific meta key from “choose from the most used tags”
  74. What is the action hook to use if you want to capture the new password during password change?
  75. How can I edit comment meta value before it is saved?
  76. an action hook when a post reaches a certain number of views
  77. Action hook to control access to certain parts of my site
  78. Need to return shortcode text instead of the output
  79. Excluding posts by meta, and also keeping posts without the meta
  80. Where exactly does the edit_{taxonomy} hook fire?
  81. Is there any reason for the nested filters to be applied on the first case and not in the second one?
  82. Replace Data In Post & Update Meta Field Post Is Saved
  83. Filter Media by attached page or blog post in Library
  84. How to add custom media library mime icons?
  85. Add filter return false not working
  86. Security question – Display a General Custom Login Error Message
  87. Filter wp_mail based on content type
  88. Add HTML to the bottom of each post in a post list
  89. Hook inside a hook
  90. Incrementing content with extra text after save/publish
  91. WP Dashboard -> Posts-> Filter by Category -> Form Method Change : Which Hook
  92. Add class to all parent elements inside the_content
  93. Adding an orderby filter, casting postmeta with multiple keys
  94. Getting entry ID from frm_email_message filter in formidable
  95. Better way to change the default password reset url with the woocommerce one?
  96. Hooking/Filtering theme name to add theme directory
  97. Replacing text using add_filter
  98. Passing value from one hook to another
  99. Change password reqts with NO plugin without breaking resetpass link?
  100. How to add custom field to top of WordPress Comment Form for both logged in and anon users
Categories filters Tags filters, get-the-title, hooks, post-meta, title
Default Template infinite loop of Title
How to embed php page from separate site

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress