0

Experienced in PHP but new to WordPress, so excuse me if I'm not calling things the right things.

Basically my set up is that I want the pages to be called one thing in the admin area for ease of identification, but to use a more of a long tail keyword as the page's h1. By default both of these seem to use the_title().

So there are pretty much two approaches to this: 1) change the admin area to use something other than the_title().

2) Change the page templates in my theme to use something other than the_title().

I would imagine that changing the admin area would be more difficult to maintain, e.g. get overwritten by version updates. Are there any disadvantages to updating my theme files to not use the_title()?

Some input on best practice would be great, or advice if I should just use a plugin instead?

1
  • You can create the metabox to add the alternative title to use its content in place of the_title() in your templates. Or you can use Yoast SEO plugin to do it for you.
    – Max Yudin
    Commented Apr 20, 2017 at 10:00

1 Answer 1

0

I'd leave the public-facing titles (the_title()) alone so you don't have to mess with filtering things if you change plugins or themes. Adding postmeta is not a big deal, and it's not hard to maintain/sustain. It also will not get removed/overwritten with updates. The biggest benefit here is that if you forget to add a custom title, it will only affect you. If instead you try to use something other than the_title() in the public-facing version, if you forget to add the custom title, you could end up accidentally displaying a post with no title.

On the editor screen, you would add a custom postmeta box. Then in the editor view, you would type in your "admin title" in this meta box. Alternatively, you could choose to use a custom fields plugin to make this easier to accomplish - some of these plugins will allow you to mark a field required, so that if you forget to enter the "admin title" when you publish a post, you'll get an error message reminding you to fill it in before it will let you publish.

From there, you can add a new "admin title" column in wp-admin - this is called a custom list table column. You can even make it sortable to alphabetize by your "admin title" rather than by the_title().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.