• Resolved Irene

    (@arlinaite)


    I have two folder subsites with same settings and same plugin, all updated. In one of the subsites I see images in the internal search results.

    The only difference between theme is that the main url redirects to it.

    example.com redirects to example.com/es

    Thanks in advance

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello Irene!

    What are you looking to do exactly with your two websites? Show the images in the search results or not show them.

    Please include the URL of your other website to compare them, and see what might be happening.

    Thread Starter Irene

    (@arlinaite)

    Sorry, I don’t want images in the internal search results.
    surdelsur.com/es
    surdelsur.com/en
    Thanks in advance

    Thread Starter Irene

    (@arlinaite)

    Hi,

    I found the solution for exclude images (attachments) from search results in WP internal search.

    Is this code snippet, using WordPress functionality
    The code must be add to functions.php:

    // Exclude images from search results - WordPress
    add_action( 'init', 'exclude_images_from_search_results' );
    function exclude_images_from_search_results() {
    	global $wp_post_types;
     
    	$wp_post_types['attachment']->exclude_from_search = true;
    }

    I find very useful this plugin for adding code, instead of adding directly in the functions.php:
    https://www.ads-software.com/plugins/code-snippets/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Images in internal search results’ is closed to new replies.