Ready to get started?Download WordPress


Ignore image urls in wp_query search (1 post)

  1. jml6m
    Posted 6 months ago #

    I'm doing a keyword search using wp_query as so:

    $wp_query = new WP_Query( 's=' . $_GET['s'] );

    It is returning a post that has $_GET['s'] in one of its image URLs, and I don't want this to happen. I'd like to exclude any attachment URL from the search.

    Is this possible using the wp_query arguments? Maybe a way to only search the title/body of a post?

    Link to related SO question: http://wordpress.stackexchange.com/questions/131414/ignore-image-urls-in-wp-query-search


You must log in to post.

About this Topic