Ahh iv figured out a way to do this:
<?php
$args = array(
'post_type' => 'classes',
'orderby' => 'title',
'posts_per_page' => -1
);
$the_query = new WP_Query( $args );
$unique_titles = array();
if( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
$title = get_the_title();
if( ! in_array( $title, $unique_cities ) ) :
$unique_titles[] = $title;
?>
Related Posts:
- WP insert post PHP function dynamically generated Custom Fields
- Inserting data into `post meta` table?
- WP_Query search posts by custom post type and custom taxonomy
- Conditional to modify query results
- Custom query to filter posts that have current post as a taxonomy [closed]
- creat filter with wp_query
- How do I get the index for a custom post?
- Check that a slug is present in the get_terms request
- Custom post type order by post_title
- Code in custom widget queries all posts, when it should only query the current post
- Order custom post type is beign ignored
- Blog page showing same content as homepage
- query posts and custom post type with meta key
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Use get_post_types to query only custom posts types
- WordPress Orderby Numeric Value Not Working
- Using several custom fields as custom post title
- Custom Post Type without an archive page
- Get rewrite slug of custom post type in template
- Show Different Header on a Specific Post ID
- Get Post Primary Category
- Weird problem happening with custom taxonmy when creating/updating posts
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- Admin notice not displaying
- Can’t get order_by meta_value_num to work properly
- Create custom post type on successful woocommerce order [closed]
- Query string parameters from custom fields, inconsistent results
- Custom Post type is being ignored in query
- Adding custom tables to WordPress
- Query custom post type only if it contains another custom post type
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Add post_type to index.php
- Very Slow Page – How to Optimize # of Queries?
- Dynamic page outside WordPress
- Using wordpress template tags within an array
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Order By Post Type ThenBy Taxonomy
- Getting the URL of the parent page
- Custom post type permalink returns bad url
- Return the thumbnail meta data for getter and setter
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- Pagination for custom php code
- get_posts of Custom Post Type AND Custom Taxonomy
- What’s the difference between same wp functions get_posts(); functions in different form?
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Custom Post Type Loop throws 500 error when used in widget
- how to check if custom post type column already exists?
- Am unable to reset a query properly
- Get posts from a custom post type by child categories of a parent category
- Received nothing after executing AJAX post function
- How to make sure content doesn’t display if selection is empty
- Custom post type redirected to homepage – how to debug
- How to modify archive query with pre_get_posts to append CPTs?
- Custom Post-Type not in admin menu
- get the custom post type title/name
- Page vs Custom Post Types Differences/Issues
- If post has custom field then display css-class
- Push metadata in array
- How to customize a permalink (URL) structure?
- Troubles with saving metabox
- CPT + CMB2: data not displaying for only first post in loop
- How to make a field appear only if a post meta field has a defined value?
- Replace text in post from cvs
- Get next and previous 3 posts in a term in single post page
- Get parent categories of custom post type
- convert custom query to wp_query
- Can I list a custom post type within another custom post type in the admin area?
- Get custom post type list for every category shortcode
- Making certain categories of CPT not publicly queryable
- How do i calculate the total of values of custom fields in custom post types?
- Search / Filter posts on Title/Content OR Tags
- Get parse_query filter to return slug instead of id
- I would like to have different styles for my posts based on the content of each post
- Checking if Post Title is Unique as Loop Criteria
- Querying both pages and posts
- Query & Order posts by custom fields
- Custom post type – get_day_link()
- Meta query for custom post type ignored in main query
- Set URL link to featured image of custom post type
- Custom Tag Description unable to display just below and outside of the Loop
- AJAX load more for different custom post type loops
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Querying Two Custom Post Types with OR Not Working
- How do I move/order posts with a tag to the end?
- On update or create post redirect to current post position in list
- I need to add endpoint for wordpress categories
- I’d like to cycle through existing posts in a post type, showing one per day ordered by title, and starting over when the last is reached
- 404 error when navigating to a taxonomy page with Cyrillic, what’s wrong?
- Changing wordpress publication date to ACF date and time picker date not working
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Use custom metabox to update automatically a post after a given date
- get_post_meta not working on publishing
- Redirect 404 page with ID in slug to associated page with same ID in slug
- WordPress wrapped added a span tag to every single p tag
- How do I add a custom screen for a custom post type to be called from custom post row action?
- ACF field key/value to show on taxonomy list
- WordPress custom post type permalink rewrite shows page not found
- Using custom field content as expression in IF statement [closed]
- Can one create multiple Custom Post Types with a for loop?