You can use pre_get_posts
to hook in and change the query.
The argument passed to pre_get_posts
is the query object. It fires for every query, so you need to check some things first. Quick example (not-tested) — change the order on only the video type’s post type archive page.
<?php
add_action('pre_get_posts', 'wpse73991_change_order');
function wpse73991_change_order($q)
{
if(
is_admin() || // no admin area mods
!$q->is_main_query() || // make sure we're modifying the main loop
!$q->is_post_type_archive('videos') // is this the video archive? (you might need to change this)
) return; // bail, we're not where we want to be.
// change the order
$q->set('order', 'title');
}
Related Posts:
- Categories sorting
- Custom post type, organized by categories
- WordPress posts page for customer filtering and sorting along with category filter
- How to sort post category using its Description
- How to sort custom post’s category by id from the theme’s function.php?
- Test if a Category contains certain Custom Post Types
- Get category id from post id of a custom post type
- Displaying category archive of custom post types
- Custom sortable columns ordered by meta-value?
- Sorting a query by custom field date
- Ordering Posts List By Taxonomy Terms?
- Number of pages – multiple (custom) post types
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- Custom-Taxonomy as categories: Remove “most-used” tab?
- Categories assigned to custom post type not found
- Add filter to wp_list_categories and query what type of taxonomy-terms it use?
- List all custom post type posts from a given category?
- Restrict categories to a custom post type
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- WordPress Template Hierarchy
- Taxonomy structure of Sport site
- Getting all custom posts with a certain category
- get custom post type categories
- How to display recent / random posts by its category
- How to get category image custom post type taxonomy in wordpress?
- Custom post types and permalink
- How do I sort a custom post type admin column using two meta keys?
- Search doesn’t find tags or categories in custom post types
- Rewrite URL for only archive page (custom post type)
- Querying Term Posts in Loop
- Get Post Primary Category
- How to add custom post types to normal category pages
- Add category attribute to custom shortcode
- Linking to the most recent post in a Custom Post Type
- Posts from all the categories are being displayed instead of particular category
- Custom post type templating problem
- Conditional Statement custom post type category
- Wp_query: sort by PHP variable
- How can I make my custom posts appear in their assigned category url?
- Allow user to set custom order to a list of custom taxonomies?
- Crafting WP_Query array, sort by date
- forming WP_Query for posts of all post types but from specific categories
- PHP variable not regenerating when publishing multiple posts at the same time
- Limit amount of posts made within a custom taxonomy
- Problem with displaying posts in the CPT category
- Custom Post Types with a common category for a blog listing
- Sort and filter custom post type posts by custom taxonomy
- WordPress Doesn’t Generate Taxonomy Archive
- manage_edit-{post_type}_sortable_columns sorts, but wrong!
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- How do you create a custom template to display a category with an image and related posts below?
- Category.php template for custom posts
- Archieve.php not loading for custom post type
- Custom Empty Results page for my Custom Post Type
- Category archive in with conjunction with custom post type is empty
- Assign category a default post type
- List Posts By Custom Taxonomy
- How to Display Posts From Category Within a Custom Taxonomy?
- Need help deciding on a taxonomy
- Category Icon on custom post type
- Get Posts by Category, Tag , and CPT Taxonomy
- Sort results without WP_QUERY?
- Get child categories of custom taxonomy category?
- Create query for both custom post type and category
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Custom post types category
- sort by name (slug) custom post type
- Get terms for a specfic post from multiple taxonomies in custom post type
- Add Extra Category Field to CPT Categories
- cannot achieve this structure (custom posts VS categories VS ??)
- Custom post type, taxonomy and admin bar
- Advanced archive url structure (category, tag and date)
- Display all Categories except ones with a specific parent
- Custom post type archive page filters
- Custom query using one category that is used in all custom post types
- get taxonomies from terms
- Custom Post Types – trying to make “title” display
- Show Custom Post Type based on Category on Archive Page
- Convert With Custom Post Type
- To display the category of a specific custom post type
- Specific template for subcategory of custom taxomy
- Custom category taxonomy – archive page not showing up
- Custom post type category archive URL redirects to home page
- Structuring 3K pages in WordPress
- Get full control over custom post type url
- How to switch from custom post type URL to category URL?
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Display 2nd category, only once, as sub-heading, in the loop
- archive.php can’t find categorized posts
- wp_list_categories() with attachment post types
- Using get_terms() as shortcode attribute
- category_name not working in WP_Query
- How can I set up the URL for a category archive for a custom post type?
- Page that ‘subscribes’ to multiple categories
- Return Custom Post Type Categories
- Using tax_query to get single post per category
- What Is My Fault With This WP_QUERY ? [ Pagination Problem ]
- Is it possible to make is_category() recursive?
- Can a taxonomy of a custom post type be called ‘category’?
- Categorizing Custom Posts in Bulk Based on Title