Skip to:

Setting BuddyPress pages to ‘noindex’ using Yoast SEO

  • notpoppy


    I want to prevent pages generated by BuddyPress from appearing in search engines to avoid being penalised in rankings due to ‘index bloat’.

    I use Yoast SEO to control which parts of my site are and are not indexed. At present Yoast adds the following code to every page unless I set an option within the plugin not to do so:

    <meta name='robots' content='index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' />

    However if I tell Yoast not to index a particular area of the site, such as the date-based archives, I can tell it to change that code to:

    <meta name='robots' content='noindex, follow' />

    I thought there might be a similar option to ‘noindex’ BuddyPress-generated pages. However after swapping emails with Yoast’s support team it turns out there isn’t because of the way BuddyPress is built:

    Unfortunately, it seems BuddyPress registers their group’s content type in a way that does not make it available to our plugin. We’re not sure exactly why this is, but it may be useful to check with their support team to see if they have a solution.

    As Yoast is such a popular plugin I thought others might have found a way to achieve this. I have found examples of code here for functions.pho which allows me to add ‘noindex’ to all BuddyPress-generated pages:

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

    But this appears in addition to the code added by Yoast, and it is obviously not a satisfactory to have both ‘index’ and ‘noindex’ on the same page.

    What I need is a way of telling the site ‘if this page has been generated by BuddyPress, do not add Yoast’s index code, add noindex code instead’. But my coding abilities aren’t up to this and I don’t even know where to start. Can anyone help please?

  • You must be logged in to reply to this topic.
Skip to toolbar