Remove Private/Protected from Post Titles


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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');

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.