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. WordPress hooks/filters insert before content or after title
  9. How do filters and hooks really work in PHP
  10. Trouble understanding apply_filters()
  11. Issues with title-tag and document_title_parts
  12. How to hook a filter to catch get_post_meta when alternate a custom field output?
  13. How many filter/action hooks are healthy?
  14. How to use update_{$meta_type}_metadata filter to modify meta value
  15. Filter specific shortcode output?
  16. Earliest hook to reliably get $post/$posts
  17. How to pass/get data to/from the WooCommerce data-product_variations object?
  18. Where to hook into post content?
  19. What does (10, 2) mean when used with add_filter
  20. Clarification on filters and hooks
  21. Valid characters for actions, hooks and filters
  22. How to hook into unregistering a widget instance?
  23. How to check if a hook is hooked or not?
  24. Remove description from on Home
  25. Passing Additional Parameters to add_filter Callable
  26. What hook do I use to edit the post statuses option in admin?
  27. Filter hook before create order WooCommerce
  28. Modify WordPress Rest Api Request/Response
  29. How to add some custom HTML into wordpress admin bar?
  30. Custom theme hooks / filters – passing arguments
  31. wp_mail – Remove sitename from email subject
  32. Remove “Private” + “:” in title does not work
  33. Filter Widget Title Wrap
  34. How to disable all WordPress emails modularly and programatically?
  35. How to hook wp_list_pages?
  36. apply_filters() slices away needed arguments
  37. Don’t replace “|” with Empty String (“”) when generating slugs from title
  38. WP Rest API – Upload media without saving attachment post
  39. How to make post and comment count unclickable with dashboard_glance_items hook
  40. How to use the_excerpt in a filter hook?
  41. How to add attribute to output with wp_video_shortcode add_filter
  42. How to change Woocommerce breadcrumbs content?
  43. Hook into admin post list page
  44. How to limit the pages displayed for choosing parent page on page attribute’s menu?
  45. How can I hide all posts that don’t have a thumbnail?
  46. How can I display image metadata?
  47. Add an attribute to the root from functions.php with add_filter
  48. Would like to use hook or filters to customize email templates
  49. Hook to add content after date in post?
  50. Is it possible to assign a css id to a row in plugins list table?
  51. Right filter for rewriting page statuscode
  52. Add filter return false not working
  53. How to filter page title for certain page?
  54. Add Index to Item in WordPress Gallery
  55. Remove image of srcset
  56. Re-order search results with posts_orderby filter and post meta value
  57. Security question – Display a General Custom Login Error Message
  58. Filter wp_mail based on content type
  59. Add HTML to the bottom of each post in a post list
  60. Adding Filter | Page Title | Template | Why the_title affecting on menu?
  61. How to filter wp_get_recent_posts() to only posts that have thumbnails?
  62. Hook inside a hook
  63. Incrementing content with extra text after save/publish
  64. Adding user filter – Not updating data in URL
  65. wp_editor customization
  66. How to check which submission button was clicked?
  67. Converting restricted html in comments to bbcode
  68. Why none of xmlrpc filters work
  69. How to add more than one custom metadata as filter on the post list page?
  70. WP Dashboard -> Posts-> Filter by Category -> Form Method Change : Which Hook
  71. change attachment custom field onChange event
  72. How to add a class to Buddypress avatars in the Activity stream? [closed]
  73. Admin filter/error if post title is too long
  74. Add class to all parent elements inside the_content
  75. Adding an orderby filter, casting postmeta with multiple keys
  76. Which hook should be used in this case?
  77. Filter dashboard custom post listing by user
  78. Getting entry ID from frm_email_message filter in formidable
  79. WooCommerce comments_template Filter Not Firing
  80. Admin New Order: Autofocus on Search a product
  81. NextGEN Gallery: Adding drop-down menu widget to gallery view without modifying plugin code [closed]
  82. How to filter part of a variable if it is no array?
  83. str_replace css meta tag?
  84. How do you disable the verification process of user email changes?
  85. How to use apply_filters(‘get_calendar’) to change get_calendar() output?
  86. Can you call a filter hook by “add_action”?
  87. Better way to change the default password reset url with the woocommerce one?
  88. Hooking/Filtering theme name to add theme directory
  89. How to elect position of new item output in a dropdown when using add_filter
  90. Replacing text using add_filter
  91. Passing value from one hook to another
  92. Change password reqts with NO plugin without breaking resetpass link?
  93. How to Dynamically Switch WordPress Front Page Without Causing Canonical Redirect?
  94. hook on the_excerpt
  95. Why wordpress doesn’t allow to add author filter to media library page in grid mode
  96. “Invalid parameter(s): attributes” issue in context of “blocks.registerBlockType” filter
  97. Adding custom filter not working
  98. Core/Image access caption in render_template and in wp.hooks
  99. Ship block templates or block template parts with plugins
  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
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 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