Show only posts with specific keyword in title
-
I want to show all posts of a specific category containing a custom keyword in the post title.
What works is:
<?php $args = array('category_name' => 'interviews', 'posts_per_page' => '999' ); $the_query = new WP_Query( $args ); while ( $the_query->have_posts() ) { $the_query->the_post(); ?> <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <?php } ?>
But when I add `’s’ => ‘peter’ to $args, nothing is found (to get only interviews with Peter). Using only ‘s=peter’ does’t do the trick also.
But searching for ‘peter’ with the standard search box does bring up the correct posts.Any hints?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Show only posts with specific keyword in title’ is closed to new replies.