• Can pages be excluded from search results based on their URL, e.g. anything including “/members-portal/”?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Well, it might be doable, but only via using a custom code. I have quickly constructed a small snippet to do that:

    add_filter( 'asl_results', 'asl_exclude_by_url', 10, 1 );
    function asl_exclude_by_url( $results ) {
        foreach ($results as $k=>&$r) {
            if ( strpos($r->link, '/members-portal/') !== false ) {
    			unset($results[$k]);
    		}
        }
        return $results;
    }

    Try adding this code via the?Code Snippets?plugin or to the?functions.php?file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the?safe coding guidelines.

    All the best,
    Ernest

    Thread Starter GregF

    (@gregf)

    Thank you. I’ll give this a try.

    -Greg

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude pages by URL’ is closed to new replies.