wp_query to show pages that starts with some character

have question about wp-query function in wordpress. My question is, is it possible to show just pages that starts with some char. For example I want show all pages that starts with char A and also that page is child of some parent page.
I know how to show child page with some full name:

$query = new WP_Query( 'pagename=contact_us/canada' );

Now I want something like:

Read More
$query = new WP_Query( 'pagename=contact_us/c%' ); 

So all pages that name begins with c ? I try this with with SQL logic and use % for any char. But it is not work for me.

Related posts

Leave a Reply

1 comment

  1. I figure out this and if someone will have same issue here is the solution:

    <?php
        $child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_title like 'T%' AND post_parent = '746' AND post_status='publish'");    ?>
        <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
        <div class="leksikon_rezultat">
    
                <span><?php echo $pageChild->post_title; ?></span>
                <a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo "Opširnije"; ?>"><?php echo "Opširnije"; ?></a>
        </div>
        <?php endforeach; endif;
    

    So with $wpdb (object of wordpress class wpdb) you can use classic SQL to get any data from any table in wordpress database.