How to hide page titles in WordPress without plugin

Posted on

How to hide page titles in WordPress without plugin

Hiding page titles in WordPress without using a plugin involves making modifications to your theme files. Here's a step-by-step guide:

  1. Access Your WordPress Theme Files: You can access your theme files through your WordPress dashboard by navigating to Appearance > Theme Editor. Alternatively, you can use an FTP client to access your WordPress files directly.

  2. Backup Your Theme Files: Before making any changes, it's essential to create a backup of your theme files. This ensures that you can revert to the original state if anything goes wrong.

  3. Locate the Theme Files: Depending on your theme, the file structure may vary slightly, but generally, you'll be looking for the following files:

    • header.php: This file usually contains the code for the header section of your website, including the title.
    • page.php or single.php: These files control the layout of individual pages or posts.
    • functions.php: This file contains theme functions and can be used to add custom code.
  4. Remove the Title from Individual Pages:

    • Open the page.php or single.php file in the theme editor.
    • Look for the code that displays the title. It typically looks like this:
      <h1><?php the_title(); ?></h1>
      
    • Delete or comment out this line of code to remove the title. For example:
      <!-- <h1><?php the_title(); ?></h1> -->
      
  5. Remove the Title from All Pages:

    • Open the functions.php file in the theme editor.
    • Add the following code to the file:

      add_action('get_header', 'remove_page_titles');
      
      function remove_page_titles() {
          if (is_page()) {
              remove_action('genesis_entry_header', 'genesis_do_post_title');
          }
      }
      
    • This code will remove the title from all pages. If you're using a different theme, you may need to modify the remove_action function call to match how the titles are added in your theme.
  6. Save Your Changes: After making the necessary modifications, make sure to save your changes. If you're using the theme editor in WordPress, you can save directly from there. If you're using an FTP client, upload the modified files back to your server.

  7. Clear Cache: If you're using a caching plugin or server-side caching, make sure to clear the cache to see the changes reflected on your website.

  8. Test: Visit your website to ensure that the page titles are no longer visible on the pages. If everything looks good, you've successfully hidden the page titles.

  9. Monitor for Updates: Keep in mind that if you update your theme in the future, your modifications may be overwritten. Make sure to reapply them after updating or consider creating a child theme to prevent this from happening.


This CSS can also hide all page titles when you apply it, however it has been updated so that it will only hide the entry title for all pages and exclude the page titles for posts and archive.

body:not(.blog) .entry-title, body:not(.archive) .entry-title, body:not(.single) .entry-title  {
    display: none !important;
}

By following these steps, you can hide page titles in WordPress without using a plugin. Remember to proceed with caution when modifying theme files and always create backups to avoid any unintended consequences.

Was this helpful?

Thanks for your feedback!