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
add_filter('posts_where', 'first_character_posts_where' ); | |
function first_character_posts_where($where) { | |
global $wpdb; | |
//Take in a URL parameter | |
$alpha_filter = sanitize_text_field( $_GET['alpha'] ); | |
// throw a different regex where at the database depending on if we want numbers or a specific character | |
if( $alpha_filter !== false && $alpha_filter == 'number' ) { |