Posted By

jamiebrwr on 07/08/11


Tagged

wordpress


Versions (?)

Remove Private/Protected from Post Titles


 / Published in: PHP
 

URL: http://css-tricks.com/snippets/wordpress/remove-privateprotected-from-post-titles/

  1. function the_title_trim($title) {
  2.  
  3. $title = attribute_escape($title);
  4.  
  5. $findthese = array(
  6. '#Protected:#',
  7. '#Private:#'
  8. );
  9.  
  10. $replacewith = array(
  11. '', // What to replace "Protected:" with
  12. '' // What to replace "Private:" with
  13. );
  14.  
  15. $title = preg_replace($findthese, $replacewith, $title);
  16. return $title;
  17. }
  18. add_filter('the_title', 'the_title_trim');

Report this snippet  

You need to login to post a comment.