Remove 'Private' prefix from pages and posts (3 posts)

  1. irny
    Posted 2 years ago #

    I guess I'm tired, because I'm going round in circles here.

    I'm trying to remove the 'Private' prefix on private posts (and in archive/category view) but I'm struggling a bit.

    I had the following pasted into the bottom of my funtions.php file earlier, which I think was working...

    function title_format($content) {
    return '%s';
    add_filter('private_title_format', 'title_format');
    add_filter('protected_title_format', 'title_format');

    ... but I've migrated to a child theme since then, which might be why it's not working any more?

    I've also tried whacking something like this:

    function the_title_trim($title=null)
      $title = the_title('','',false);
      $pattern[0] = '/Protected:/';
      $pattern[1] = '/Private:/';
      $replacement[0] = ''; // Enter some text to put in place of Protected:
      $replacement[1] = ''; // Enter some text to put in place of Private:
      echo preg_replace($pattern, $replacement, $title);

    into my child theme's style.css file, but that does nothing as far as I can tell.

    Anyway, going round in circles. I know there have been previous discussions on this, but I can't make anything work. Any advice appreciated.


    Oh, and if anyone knows how I might be able to to tweak the 'Nothing Found' message brought up here — your thoughts would be much appreciated. I've drawn a blank there, too.

    Best, Sarah

  2. TheB741
    Posted 2 years ago #

    Do you have the pages set to private?

  3. irny
    Posted 2 years ago #

    There is one test post on the site set to private. It show up under the 'Members' news' category if you are logged in.

    Is this what you meant?

Topic Closed

This topic has been closed to new replies.

About this Topic