You can use preg_match
function:
foreach($stores as $store)
// if $store starts with A or B
if( preg_match( '/^(A|B|a|b)/', $store ) )
//I've not checked this one
$groups[mb_strtoupper(mb_substr($store->name, 0, 1))][] = $store;
Related Posts:
- get_the_term_list without links in 3.1
- wp_insert_term – parent & child problem
- Custom order of terms for custom taxonomy in admin and website
- Custom Fields and performance
- Creating a custom Admin panel
- Remove description in custom taxonomy edit screen
- get_the_term_list without specific category
- Extending wordpress search to include excerpts and taxonomies?
- wp_query to display custom taxonomy terms
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- Creating an Archive using a Custom Taxonomy
- List Recent Post Titles from Custom Taxonomies?
- Custom Taxonomy Term Caching?
- Some of my custom taxonomies are not showing but still counted in a WPMU set up
- add hirarchy of categories in products grid of visual composer
- Add success message to category add screen
- wordpress testimonials
- Hiding taxonomies with no children WP_Query & tax_query
- WordPress Custom post query sorting does not work
- Custom taxonomy not appearing in menu administration panel
- Best structure for entering recipes in a WordPress theme?
- Get Terms for Page
- Add attribute taxonomy through code don’t appear in admin product page
- Best way to redirect taxonomy terms to pages
- Create alphabetical Pagination for custom taxonomy?
- Taxonomy Overview Page?
- Featured Images for Tags?
- Query Multiple Custom Taxonomies
- Use wp_list_categories to list parent categories from actual term
- Remove Custom metabox from particular page template is used
- Restrict viewing of posts by category, user role
- Assign a default description to new terms under a custom taxonomy
- WordPress tag or archive php file customization
- Best Method to Switch Between Terms (Custom Taxonomy)
- WordPress shortcode Issue!
- Why is it defaulting to “uncategorized” even after I select a custom taxonomy
- Trying to achieve row posts below category with multiple loops in custom tax
- Custom Taxonomy, shows empty value (home page of website)
- Custom Search only for my Custom Taxonomy Page – data
- Remove taxonomy base or term from url
- Bulk term assignment for attachment taxonomies
- Creating custom Woocommerce attribute taxonomies from a plugin
- Taxonomy slug by term ID
- How to enable hierarchical permalinks for hierarchical taxonomies
- Create taxonomy with meta term using the WP Rest Api
- wp_get_object_terms – How can I order the resulting array by hierarchy?
- How to output the taxonomy term name in a widget
- Make Custom Taxonomy Category Use Parent Template
- How to call custom taxonomy categories with shortcodes
- How to get terms of a custom post type in a loop inside footer.php
- Is It Possible To Have Shared WordPress Custom Post Types?
- How do I make a custom taxomony appear like tags?
- Display post taxonomies tree
- How can I add buttons to a custom column in the taxonomy table?
- WP_Query on custom taxonomy works fine but fails if run through wp_ajax_
- JSON API – search by custom taxonomy
- 404 error- issues with pages after adding custom rules for posts
- Wrapping result of the_terms in a span with a class of the term name
- Howto control custum taxonomy order?
- I am trying to display information from a custom table from my wordpress users pages
- Save custom taxonomy data in different table not in wp_options for my own plugin
- Retrieve Custom Taxonomies according to posts selected
- Can I use OR relation for one item when calling tax_query from WP_Query and use AND for the rest?
- get_terms not returning any custom taxonomies
- I don’t need ‘view’ page for my custom taxonomy
- WordPress implode & wp_insert_post question
- How to write sql query to get the posts from a custom taxonomy term name
- How to do a particular wp_query taxonomy search
- How to display a custom taxonomy without a link?
- Get post count for current custom taxonomy
- Build filter for post-type + multi taxonomies + multi terms
- get_term_by works but get_terms doesn’t?
- Fix Custom Taxonomy Display two times on each call
- Update Custom Taxonomy Value for a post based on custom date field
- How to output taxonomy term (incl. link to archive) on author.php?
- Taxonomize taxonomy terms?
- displaying posts from a custom post type tags
- Showing relevant categories on custom taxonomy template
- Taxonomy page loading wrong data
- How to use custom slug and custom templates for custom taxonomy?
- how to show product custom taxonomies in woocommerce rest api
- Auto add custom taxonomy to permalink when save
- WP Tax query & order by tax query not working
- Show latest used taxonomy in homepage
- What’s the url queryvar for a taxnomy archive?
- Permalink Rewrite to include Custom Taxonomy Term
- Where is defined a custom register_taxonomy? [closed]
- Differentiate Parent & Child of Custom Taxonomy
- Listing all selected terms for custom taxonomies on a post
- Multiple Taxonomy in URL/Query – No Custom Post Type
- Calling Custom Taxonomy Dropdown in Form
- Displaying Custom Taxonomy List Posts By Slug?
- Show different sidebar on taxonomy pages when a default is set
- How can I get parent term from a child term
- Custom Taxonomy – Archive for the whole Custom Taxonomy (and not just single term)?
- ACF Display Taxonomy Image Field
- Guest author – URL, base and custom taxonomy – working but unstable
- Add Gutenberg editor to edit taxonomy (category) page
- post_type_link not working for posts without terms
- Why my archive title isn’t showing?