You can change the sort order on a category archive page to show posts by title (A-Z) by adding this code to your child theme’s functions.php:
/* Sort posts by title for a specific category */
function change_category_order( $query ) {
//Sort all posts from category with id=3 by title
if($query->is_category('3') && $query->is_main_query()){
$query->query_vars['orderby'] = 'name';
$query->query_vars['order'] = 'DESC';
}
}
add_action( 'pre_get_posts', 'change_category_order' );
You need to replace “3” with the correct category id. You can find out the category id by heading to dashboard => post => categories and hover over the category you want to adjust the sort order.
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Why is this custom taxonomy showing in the database?
- plugin for wp_list_categories with posts
- How to add rewrite rules and pagination to retrieve attachments files?
- Show Heirachy of categories in WP Download Monitor
- Possible to replicate economist.com’s debate section in wordpress? [closed]
- My Category is too big on the Menu what can i do?
- WordPress category add image field
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- polylang + category/tag custom language link
- How do I apply style to each category of a list?
- .php file for woocommerce edit category? [closed]
- Renaming Custom Taxonomy Values
- How to hide featured images of all posts falling under the same category in wordpress?
- Adding category base to url in custom post giving 404?
- Precheck fields when I add a new post
- Add custom WordPress admin page with pretty url via code
- Cannot view Custom Post Type no matter what I try
- Create survey that redirects to sidebar menu customized to answers
- Taxonomy Category Icon on index page
- Sub Categories in drop down menu
- How can I pass value to function in add_menu_page?
- Category archive in menu
- How can I add the custom taxonomy categories to the posts and pages?
- Make a Custom template for a specific category in wordpress
- How to pre-set WordPress settings for specific posts?
- How to make horizontal scrolling menu [closed]
- Best collection of code for your 'functions.php' file [closed]
- Should all plugins be encapsulated in a Class?
- OpenID for WordPress 3.x? [duplicate]
- Get a button for in the Editor
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- How to add product images using script?
- How do I make a wordpress plugin with menu item etc
- How to use get_categories() with Event Organiser plugin
- Setting up widgets in wordpress with a unique ID for the after_title argument
- taxonomy_template filter do not loads custom taxonomy template properly
- Use plugin or custom post type for game score functionality
- Copyright messages for a particular set of pages
- how to load the language file in plugin?
- Getting a List of Categories for Use in a Plugin?
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- How to make a customize role and view a specific plugins base on that role?
- View Private Published Page with URL Code (no login required)
- Solutions to repost categories into multisite blogs?
- Translating long texts with html formatting
- Assign post format to categories
- Does any one have Idea to get these functionalities with the plugin wp-multi-network
- custom payment gateway in woocommerce failed to connect to remote api server
- WP_Terms_List_Table Quick Edit not working
- Changing page URL and connect newsletter to MailChip
- Anspress Customization: How to show logged in user votes on a single answer?
- Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?
- “Custom Post Type Permalinks” plugin URL strcuture
- “No Add Button” for me to customize my WordPress with themes and pluggins
- Translation plugin to translate another plugins
- Customizing Titles on the Fly with Code
- Best/Correct way to add an option to a category
- Text change in Advanced Customs Fields [closed]
- Loop in elementor custom widget not working
- Mutliple users editing single document in wordspress
- Same menu for different taxonomies to reach different content
- How to display an alert when deleting a plugin?
- unregister a sidebar widget
- How to disable Wp-PageNavi at the top of the page
- 404 errors when updating options in admin dashboard
- Display WordPress comments before the plugins?
- Mobilepress fails to translate short codes
- Rename existing cpt and taxonomy with new textdomain
- Get product categories and add them to a custom taxonomy
- Slideout submenu in mobile
- Getting infinite scrolling working on my custom template
- Making a list that can be filtered by category/tags
- how to change a static testimonials into dynamic
- working code, not working – Plugin Dev
- Custom shortcode being shown in WPBakery backend rather than the block
- Issue calling my functions on Plugin activate in WordPress
- Create dynamic / data driven pages in wordpress
- custom/automatic export function – one post at a time?
- The etiquette of forking a plugin and table tag
- Custom SportsPress list
- How to restrict “too soon” downloads with a general rule?
- Confusing problem with displaying message recipient metadata
- Display Powerpress media url
- Hide some shortcodes on posts from back-end
- “Tree view” for wp_dropdown_categories() markup
- Award points if a specific custom taxonomy is selected – Cubepoints
- Display static pages instead of category, in code
- formatting the way posts show up
- Call to a member function get_page_permastruct() on null
- Automatically put a menu on every post
- How to avoid conflict between plugin and its edited version?
- How to give different user access to different people?
- hide particular category post from front page only [closed]
- Create WordPress category dynamically
- Take Elementor For Email FIeld Check if user is registered. IF not registered then register on woocommerece
- How to create specific wordpress Table
- Adding “Changelog” as a second tab to the auto updater custom plugin
- how can add review by, edit by (Author) on wordpress site
- How to make a page setting translatable in theme?