Update:

So, you’ll notice that the Title Tag of this page contains the term Private, but the H1 tag above doesn’t. This is a result of doing what I exlpain below. If you have a solution to fix this, leave it in the comments, please.

————————————————————-

I love the fact that you can make pages private in wordpress. It’s the easiest way to make a page not appear in the navigation, but still exhist on the site.

My problem has been that when you do this the title of the page changes from:

“Title Goes Here”

to:

“Private:Title Goes Here”

Now, I don’t understand the logic behind why it does this without there being an option to change it in the admin area, but I finally figured out how to fix it.

Go into the theme directory of the theme you’re using and back up the functions.php file.

Now, add this:

function remove_private_prefix($title) {
$title = str_replace(
'Private:',
'',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');

If you’re lucky like I way, “Private:” will magically go away. No more worries!

5 Responses to “Take out of WordPress Titles”

  1. Tracey 15. Nov, 2008 at 9:54 pm #

    THANK YOU!!!!!!

    [Reply]

  2. Dave Conklin 16. Nov, 2008 at 10:54 am #

    You are very welcome!

    [Reply]

  3. Jonathan Bentz 16. Nov, 2008 at 4:02 pm #

    Awesome tip Dave.

    [Reply]

  4. James 17. Jan, 2009 at 7:39 am #

    Hi, that works fine but then when i go to redpublish a post it gives me an error:

    Warning: Cannot modify header information - headers already sent by (output started at ****/functions.php:1) in ****/wp-includes/pluggable.php on line 850

    any ideas?

    [Reply]

  5. Steve 03. Feb, 2009 at 9:57 am #

    You must have the line

    $title = str_replace(‘Private:’,”,$title);

    all on one line.

    [Reply]

Leave a Reply


Subscribe to ProspectMX Site Feed by Email