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?
- ORDER BY custom field value
- Can serialized arrays in DB be matched against serialized arrays with meta_query?
- Create a select drop down of available menus
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Only display custom field if it there is a value inside
- Slow meta query with multi meta keys
- Custom Field Multiple Clauses
- Custom field values repeating
- Send Multiple Custom Field Values Through the URL
- $wp_query meta_key naming issue [closed]
- Meta_query and numeric comparison [closed]
- Title and post URL based on custom fields?
- Separate table or usermeta
- Woocommerce with metabox plugin
- using multiple meta_key and meta_value in query_posts
- Multiple relationships in a query
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- global function to apply filter to custom field
- How to add a new meta key and assign timestamp to posts
- Print custom field in Query Loop block
- Is there a simpler version of WP Media?
- Order RSS content by an advanced custom field value
- Advanced search by two criteria – sort by location and date (ascending or descending)
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Alter main archive, to show posts with meta as last
- Add microdata from schema.org [closed]
- Displaying multiple URLs as custom field values
- Collect user custom field in product page woocommerce
- How can I save custom meta to one global value?
- get posts where a custom field contains a text
- Displaying a custom field
- meta fields for the whole wordpress site
- How to use media upload on metabox post page without breaking TinyMCE?
- WordPress creates new lines in postmeta table on post update
- How to add custom filed value after in wp post title
- User customising position of WordPress Featured Image
- Insert image into sub-field with update_post_meta
- How to Pass values to Custom Field through PHP in WordPress Posts?
- How to use conditional statement with custom field
- Custom field php
- SQL: Select wordpress posts with given text string and add a custom field to them?
- how to add product subscription field in woocommerce plugin
- How can I change the publish date based on a custom field?
- Is it possible to use get_post_meta() to control HTML?
- Editing custom fields for comments
- Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
- Getting and calculating averge value of custom fields of the same tag
- Only admin should be able to add a particular custom field
- Automatically Add Custom Fields Value as Tags
- How to speed up post list slowed by update_meta_cache()?
- Custom Fields displaying in single line
- Custom Field URL + description
- Retrive acf fields in publish_post action for wp_mail
- Issue on Creating Checkbox Field On Custom Post type
- WooCommerce 3 get custom variation on process order [closed]
- query_posts -> get page_id from custom field
- author global display format
- Output Custom Field value to shortcode
- Update custom table on metabox POST
- display custom media folders to wordpress media popup
- Should I store arrays in custom fields or create custom tables?
- Problem saving meta data
- Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page
- WP_query returns error when used for custom widget
- Form fields based on custom fields
- Post rating using Custom Field
- Inserting custom fields into new-post.php without using the Custom Fields Template plugin?
- woocommerce how in checkout to add my custom field check box, and when i check it hide the shipping adress and add tax 19% [closed]
- How can I attach files without using a plugin?
- Change Fields of Comments and make them searchable?
- Shortcode not picking up custom field