Hi @garrettb,
By default, this feature isn’t available. But you can achieve this with a custom filter.
Copy the code below and paste it to your Theme Functions file.
Note: You have to replace the word How with the text you want to use for the search query.
Code:
function wpse_298888_posts_where( $where, $query ) {
global $wpdb;
$starts_with = esc_sql( $query->get( 'starts_with' ) );
if ( $starts_with ) {
$where .= " AND $wpdb->posts.post_title LIKE '$starts_with%'";
}
return $where;
}
add_filter( 'posts_where', 'wpse_298888_posts_where', 10, 2 );
function post_grid_query_args_20200429($query_args, $args){
$extra_query = array (
'starts_with' => 'How',
);
return array_merge($query_args, $extra_query);
}
add_filter('post_grid_query_args','post_grid_query_args_20200429', 10, 2);
Where to Paste?
From your WordPress dashboard, go to Appearance => Theme File Editor. Select the Theme Functions file from the right sidebar and paste the code to the bottom of that file.
Screenshot: https://i.imgur.com/hNBKNyU.png
Let us know if it helps.
Regards.
Thanks Raju
It’s ok – I will find a different way to do this.
I have been down the road of WordPress development, and this time, I just want to ‘play’ with WordPress – no code, just plugins and settings.
Thanks
Garrett