Title: Query posts by keyword
Last modified: August 19, 2016

---

# Query posts by keyword

 *  [barna](https://wordpress.org/support/users/barna/)
 * (@barna)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/query-posts-by-keyword/)
 * Hi!
 * I would like to get posts by keyword using query_posts.
    So, how can I query 
   posts, that contain “big dog” as content?
 * Thanks.

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/query-posts-by-keyword/#post-1864583)
 * Use a filter to add a WHERE condition:
 *     ```
       function mam_posts_where ($where) {
          global $mam_global_where;
          if ($mam_global_where) $where .= " $mam_global_where";
          return $where;
       }
       add_filter('posts_where','mam_posts_where');
       $mam_global_where = " AND $wpdb->posts.post_content LIKE '%big dog%'";
       query_posts(your args here);
       $mam_global_where = '';  // Turn the filter off!
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Query posts by keyword’ is closed to new replies.

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/query-posts-by-keyword/#post-1864583)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
