Replace Protected-Private Posts


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

WP Functions.


Copy this code and paste it in your HTML
  1. /* REPLACE PROTECTED-PRIVATE POSTS */
  2.  
  3. function the_title_trim($title) {
  4. // Might aswell make use of this function to escape attributes
  5. $title = attribute_escape($title);
  6. // What to find in the title
  7. $findthese = array(
  8. '#Protected:#', // # is just the delimeter
  9. '#Private:#'
  10. );
  11. // What to replace it with
  12. $replacewith = array(
  13. 'a', // What to replace protected with
  14. 'b' // What to replace private with
  15. );
  16. // Items replace by array key
  17. $title = preg_replace($findthese, $replacewith, $title);
  18. return $title;
  19. }
  20. add_filter('the_title', 'the_title_trim');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.