How to Disable Title on Posts, Pages, or Other Post Types?
|
/ Documentation /Custom Code Snippets/Astra Theme & Pro Filters/ How to Disable Title on Posts, Pages, or Other Post Types?

How to Disable Title on Posts, Pages, or Other Post Types?

The title is the name of your post, page, or other post types you might have on your website. The title appears in the frontend and can be disabled from the Title(eye Icon) or with the custom code

Method 1 – Page/Post Title

Page/Post meta settings or Astra Settings are available for each individual post or page. Thus, using the Eye Icon on the Page/Post Title you can decide for each post, page, or post type to disable the Title where needed.

To make it intuitive and easy to enable/disable we have provided this option right on the Title section, without the need to open the Astra settings.

Astra-disable-title-settings

If you wish to apply this setting to a larger number of pages or posts, then editing every page and updating the above setting can be time-consuming. In this case, you can use the Astra Bulk Edit plugin. This will allow editing the above settings on multiple pages.

To re-enable the Title, simply click on the eye icon once again and it will be enabled once again.

Method 2 – Custom Code

You can also do this using a custom code. This can be a great solution if you want to disable titles on all posts, pages, or other post types.

You can add the following custom code to the functions.php file of your Child Theme:

/** 
 * Disable title on all post types. 
 */ 
function your_prefix_post_title() { 
 $post_types = array('page','post'); 

 // bail early if the current post type if not the one we want to customize. 
 if ( ! in_array( get_post_type(), $post_types ) ) { return; } 

 // Disable title. 
 add_filter( 'astra_the_title_enabled', '__return_false' ); 
}
add_action( 'wp', 'your_prefix_post_title' );

If you don’t have your Child Theme installed, please check this article on how to do it. 

If you are not sure how to add this code, please check this article.

This code will remove titles on all of your pages and posts. You can apply this code only to pages, posts, any of your other post types, or all of them by modifying the bolded part of the code above. Here are examples how this should look like:

  • To remove titles on all your posts only:
$post_types = array('post');
  • To remove titles on all your pages only:
$post_types = array('page');
  • Remove titles on all pages, posts, and example custom post types. This is the example that you can use to add any other post types you want the above code to be applied:
$post_types = array('page','post','custom-type-1');

If you are still unable to turn the Title off from a specific post or page, please reach out to our customer delight team by clicking here.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

This field is required.

REWIND

YEAR IN REVIEW

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form