Last active
February 16, 2022 20:34
-
-
Save khleomix/1bfcb7f146b62965a87e3edfa564368e to your computer and use it in GitHub Desktop.
get_posts() with search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$posts = new WP_Query( array( 's' => $search_string ) ); | |
$posts = $posts->get_posts(); | |
foreach( $posts as $post ) { /* ... */ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment