質問: wp_query($args); while( $res->have_posts() ) : $res->the_post(); ...
回答: functions.php <?php add_filter( 'posts_where', 'title_like_posts_where', 10, 2 ); function title_like_posts_where( $where, $wp_query ) { global $wpdb; if ( $post_title_like = $wp_query->get( 'post_title_like' ) ) { $where .= ' and ' . $wpdb->posts . '.post_title like \'%' . esc_sql( $wpdb->esc_like( $post_title_like ) ) . '%\''; } return $where; } ?> そして: $args = array( 'post_title_like' => $str ); $res = new wp_query($args);