Support » Fixing WordPress » How to remove “Private” from private pages?

  • Hey guys,
    I was writting a page which I don’t want to appear in page list.
    But when I access that page directly through the URL, a Private prefix is being added to the page’s name just above the content.
    How can I remove that?

    Thanks in advance
    Abhik

Viewing 8 replies - 16 through 23 (of 23 total)
  • I found another really simple fix…

    At the bottom of functions.php just add the following code:

    <?php
    function bfa_remove_word_private($string) {
    $string = str_ireplace(“private: “, “”, $string);
    return $string;
    }
    add_filter(‘the_title’, ‘bfa_remove_word_private’);
    ?>

    Worked for me anyway!

    eq2bum

    (@eq2bum)

    Thanks guys, this is just what i was looking for.

    eq2bum

    (@eq2bum)

    hmm…well, my functions.php doesn’t have end with a ?> so i am a little confused.

    it starts with a <?php there are a couple functions for registering the left and right sidebar then no ending ?>

    any ideas?

    PSG

    (@psg)

    Hi t31os_,

    Your code works very well in Firefox but shows 404 error on IE8 and Safari 4.0.3.

    help!

    Cheers
    PSG

    @psg:
    It’s not browser specific, all it does is replace some data in a string, there should be absolutely no difference between browsers.

    @backpocket:
    preg_replace is a regular expression function. str_replace is proberly faster for this usage, but they essentially do pretty much the same. The aim of the previous code was to keep it simple, so those using it could examine and perhaps get some understanding of what’s doing what (to some degree).

    PSG

    (@psg)

    Sorry about the earlier posting. It does not show when your are logged out. Was checking other browsing in logged out mode.

    Anyway found the best way out: a Plug in called ‘Exclude Pages’

    works super and easy no codes or core files to mess with.

    http://wordpress.org/extend/plugins/exclude-pages/

    Cheers
    P

    okay, but what if i use wordpress blog in itself, not as just a motor?

    hi some of my post titles look like this:

    <b>Da dana dan</b> songs – Paisa Song from <b>Da Dana Dan</b> – Vox

    when i add this code to the functions file nothing happens:

    function the_title_trim($title) {
    // Might aswell make use of this function to escape attributes
    $title = attribute_escape($title);
    // What to find in the title
    $findthese = array(
    ‘#<b>#’,
    ‘#</b>#’
    );
    // What to replace it with
    $replacewith = array(
    ‘test’,
    ‘test2’
    );
    // Items replace by array key
    $title = preg_replace($findthese, $replacewith, $title);
    return $title;
    }

    any ideas? thanks

    this is funny i went to edit this post and noticed that my <b> symbol had been replaced with “& lt;b& gt;”

    when i put put the same code in place of <b> in the function.php filter it works fine.
    i can finally get rid of unwanted characters appearing in my post titles.

    thanks

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘How to remove “Private” from private pages?’ is closed to new replies.