No index directives on all or some GD pages

File Method

The file below has 2 hooks:

  1. add noindex to all GD pages
  2. add noindex to some GD pages, with a comprehensive list of conditionals

Should work with most SEO plugins.

gd-pages-no-index.php

Snippet

The following snippet will de-index all single listing pages.
It's possible for your developer extend it to include others, like search, archives, etc.

add_filter( 'wp_robots', 'gdsnippet_no_robots', 999, 1 );
function gdsnippet_no_robots( $robot_directives ) {

    if ( function_exists( 'geodir_is_page' ) && geodir_is_page( 'single' ) )
    {
        return [
            'noindex'   => true,
            'nofollow'  => true,
        ];
    }

    return $robot_directives;
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us