Hide or remove the Page Title with Advanced Custom Fields

For most of my WordPress projects I either use Genesis or GeneratePress as a starting point to build upon. Both themes have an option to remove the page title out of the box, which can be handy sometimes.

Last week I had to deal with a different theme and wanted to remove the page title on a few pages. I know there are some plugins available that handle this perfectly. However I decided to build this option in Advanced Custom Fields as I was already using that with the theme. Also I didn’t want to add yet another plugin to the list.

1. Adding a Field to a group

To start I created a new group in ACF and called it ‘Page Title Visibility’. I added just one field; a radio button with three options: Show Page Title, Hide Page Title and Remove Page Title.

I only want the option field to appear on pages so I put the setting in the location rules to ‘Post Type is equal to Page’.

The result in the editor looks something like this:

2. Adding the code

The next step is adding the code to the template file(s) of your (child) theme. Below is an example of how the code can look like but this depends on the theme you’re using.

As you can see in the code example above, when the option ‘Remove Page Title’ is selected, the Page Title will not be published.

So there it is, a lean method to remove or hide the Page Titles in WordPress. When you are familiar with ACF you can of course adjust this code to make it fit more specific to your needs. Enjoy!

Affiliate Disclosure

Some articles may contain affiliate links. This means I receive a small commission when you make a purchase through one of these links. However I will never recommend products that I do not support.

This site uses functional cookies. More information

Deze site is standaard ingesteld op 'cookies toestaan", om je de beste mogelijke blader ervaring te geven. Als je deze site blijft gebruiken zonder je cookie instellingen te wijzigen, of als je klikt op "Accepteren" hieronder, dan geef je toestemming voor het gebruik van Cookies.