I just realized that there was a typo in the code. The meta-tag should read ‘prod_hierar’ instead of ‘prod-hier’. This fixes the issue. (Too much experimenting, I guess ..).
Function ‘wms_hierarchy_col_orderby()‘ thus becomes:
function wms_hierarchy_col_orderby( $vars ) {
if ( isset( $vars['orderby'] ) && 'prod_hierar' == $vars['orderby'] ) {
$vars = array_merge( $vars, array(
'meta_key' => 'prod_hierar',
'orderby' => 'meta_value'
) );
}
return $vars;
}
Related Posts:
- custom field in admin columns
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Filter post listing by meta value which is a date
- Adding Custom Field to Taxonomy Input :Panel
- How to prevent custom fields from being cleared during a bulk edit?
- Custom bulk action for media gallery items
- Add custom column to custom post type overview in backend
- How to show custom field’s value under post/page title in wp-admin
- Add More Fields to Users Pages (Admin Panel)
- Admin meta Image Path
- How make a custom search on backend in WordPress without plugin?
- Custom Fields box in the post editor: Replace textareas with input elements
- Client PDF Upload (Catalogue) – Automatically update link to PDF
- Button inside Custom Meta Box triggering the Update Button
- I need a “Choose from existing content” popin
- Hide custom column in admin template screen (Elementor) [closed]
- WordPress Media Uploader custom Javascript not working
- WordPress colorpicker save both hex and RGB
- Add custom column for custom field
- Jquery on custom-field backend
- Search & column order by meta value in admin
- WordPress admin area: select box with 12.000+ options
- Link fields in User Admin list
- Save custom post data outside of default post form
- Decouple page name from page title
- How can I display only the post titles from a selected category in columns?
- Can’t sort custom column on user.php by number / meta_value_num?
- Query ‘orderby’ when there are multiple values for the same meta_key
- Custom field/meta populated by dropdown of existing posts?
- What is the index [0] for on post meta fields?
- Pass all custom fields through the same filter on post load?
- Add custom fields when specific templates are selected
- What is the advantage of the wp_options design pattern?
- update_user_meta: How many is too many?
- Search ONLY by meta key / meta values
- manage posts custom column is not populating data from meta boxes
- Correct Approach for Validating Custom Field Input
- Query meta field using between
- How to add/save Custom Field in user settings/profile “Checkbox list”
- Delete post based on a custom field?
- How to make custom comment fields required and message field not required
- Display info from custom fields in all images’ HTML
- Update meta values with AJAX
- How can I migrate all of my custom field thumbnails to the built-in post featured image?
- Multiplile values checkbox or select in custom meta box
- How to use query_posts() with a date filter on a custom field?
- Login & Register & Custom details WITHOUT plugin
- Escaping Quotes
- wp_editor removes paragraph from custom meta box
- Any way to include custom fields in WP_Query results?
- Ordering posts by date custom field
- Using a checklist to search against metadata
- Where did the Add New Custom Field go?
- Sorting WordPress Posts via Custom Field Values?
- Can’t get metabox value (a url) returned using WPAlchemy
- Syntax highligting for custom fields
- Displaying a checkbox array from advanced custom field
- Display custom field values from posts on frontpage
- WordPress: custom field display twice
- meta_compare seems to be treating values as strings instead of integers as expected
- Trying to sort and display categories(not posts) by custom field: ‘order’
- Grabbing the first image attached to a post and use it with the admin columns
- Ordering posts by custom field named “date” in backend
- How to pass page as an argument like post in WordPress?
- Custom fields issue [closed]
- Select custom posts by meta_value and sort by a different meta value
- Front end register with custom fields
- Display custom field from the front page on another page
- Display custom widget value in header.php
- Gravity Forms Update post meta from template [closed]
- Automatic linking terms
- Adding extra fields to front end signup form
- Problem uploading different files as custom fields with front end post form
- How to change order of posts in admin
- make a dropdown custom field with ‘cities’ list in it
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- Get Custom Field Name ( Label or Key ) Not Value
- Custom field on Quick Edit using select/dropdown – almost working right but not showing currently selected value
- Adding Custom Metadata to my Archive/Posts page
- Move the post title to another field
- Ordering by ACF custom field vaule
- add different custom fields value to post class if permalink or index
- author.php not showing content if Author has no Posts
- How do I display a custom field in an existing form on the front end?
- How to save array option as text and not integer?
- Extend WP_User_Query or WP_User to return all custom fields?
- Quicktag button to automatically add a custom field to a post
- Display custom fields only if it has a value
- WordPress taxonomy child image
- Create custom fields/meta data gender+country – radiobuttons and dropdown on register screen for these fields
- Add nofollow to custom field link and make domain exceptions?
- wordpress simple post multi rating with post_meta and user_meta
- Custom fields are not displaying in page with multiple loops
- Add class from custom field into widget class
- Download stuff after filling fields?
- Adding custom field to Lightbox in header only pulls current page data, not Lightbox item data
- Meta boxes not displayed, data isn’t being saved
- Custom registration form and custom field
- How can i put a custom field inside this php