WordPress.org

Forums

Ignore image urls in wp_query search (1 post)

  1. Joseph
    Member
    Posted 1 year 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

Topic Closed

This topic has been closed to new replies.

About this Topic