Skip to:
Content
Pages
Categories
Search
Top
Bottom

No index buddypress pages


  • gurusurfer
    Participant

    @gurusurfer

    Hi,

    I now the following functions is wrong, but just to give you an idea what i am trying to achieve!

    add_action(‘wp_head’,’noindex_for_buddypress’);
    function noindex_for_bu() {
    if ( !function_exists( ‘bp_is_blog_page’ ) ){

    echo <meta name=”robots” content=”noindex, nofollow”>
    }
    }

    I want to add the noindex meta to the header when pages are Buddypress.

    Any help is much appreciated!

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

  • Henry Wright
    Moderator

    @henrywright

    The Template Tag Reference will help you here. You can do things like the following inside your function to determine the type of page that is being accessed:

    if ( bp_is_groups() ) {
        // This is the groups page.
    }
    
    if ( is_buddypress() ) {
        // This is a BuddyPress screen.
    }

    gurusurfer
    Participant

    @gurusurfer

    Thank you very much for the quick reply!

    Sorry I am no php pro here, tried like this but breaks page!

    add_action( 'wp_head','noindex_groups' );
    function noindex_groups() {
    if ( bp_is_groups() ) {
     echo '<meta name=”robots” content=”noindex, nofollow>'
    }
    }
    add_action( 'wp_head','noindex_buddypress' );
    function noindex_buddypress() {
    if ( bp_is_groups() ) {
     echo '<meta name=”robots” content=”noindex, nofollow>'
    }
    }

    Thanks


    gurusurfer
    Participant

    @gurusurfer

    I have also tried in a loop like in this codex, but breaking the page, what am i missing?

    <?php if ((is_buddypress() ) { echo '<meta name=”robots” content=”noindex, nofollow>'; } ?>

    You help is much appreciated!

    Thanks


    gurusurfer
    Participant

    @gurusurfer

    Never mind, forgot the “;” 🙂


    gurusurfer
    Participant

    @gurusurfer

    Ok for the is_buddypress() the functions

    function for_buddypress() {
        if ( is_buddyPress() ) {
            echo "<meta name=”robots” content=”noindex, nofollow>";
        } else {
        }
    }
    add_action( 'wp_head', 'for_buddypress' );

    Working perfectly, but when creating another function for the bp_is_groups() I am getting error “call to undefined functions bp_is_groups()

    Any help is much appreciated!

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No index buddypress pages’ is closed to new replies.
Skip to toolbar