Try meta_value_num
'meta_key' => 'metadata1',
'orderby' => 'meta_value_num'
Add these 2 parameters to $args. This does the sorting considering metadata1 as numeric
Related Posts:
- Save metabox with multiple checkbox array
- get_posts() not working when accessing with a custom user role
- Saving value of a selection option in comment form as comment meta
- Run Shortcode of post’s custom field in functions.php / Plugin
- Delist entries in the_loop
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- Displaying Custom Post Meta
- A better way of getting draft posts that has a particular post meta using get_posts function
- How can I add an image upload field directly to a custom write panel?
- Post meta vs separate database tables
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- How to return only certain fields using get_posts()
- How to validate custom fields in custom post type?
- How to add tab which is visible only in admin side of product in woocommerce? [closed]
- Creating custom field with drop down on new post page
- Why Does get_posts() Return an Empty Set?
- get_posts / WP_Query Memory size of 134217728 bytes exhausted
- Retrieving custom fields with $wpdb->get_results
- How to create Image gallery Metabox in wordpress [closed]
- Utilize TinyMCE hyperlink chooser outside of TinyMCE
- How to enable users to down-vote in this simple voting counter (that uses the post meta)?
- anything like add_meta_box for categories?
- template_redirect for single posts w/ custom fields
- Order posts according to user defined order for meta values?
- How can I free up the memory used by update_post_meta?
- Is there a way to list tags order by post_meta field
- Support auto-save and revisions for custom fields
- Best choice of options/settings framework for plugin/theme development
- Plugin development: get_post_meta is not working [closed]
- Act on user meta updated, but only once
- How to check if Woocommerce Order number equals to post ID?
- Adding set of custom fields to WordPress Post in Dashboard
- update post meta for checkbox in the admin when inserted in the front-end
- 403 Error when text is pasted in Custom Metabox Textarea
- Custom Taxonomy to dropdown box on adminside wordpress
- Create & Save multiple Meta-boxes
- If meta key exists in get posts function otherwise create it
- Add a Save Button to Custom Meta Box [duplicate]
- get post attachment using ajax
- Plugin with action ‘save_post’ needs to press publish twice on order to publish
- Strange issue saving custom field data for a WooCommerce order
- Woocommerce – Convert Delivery method into a custom field
- How to get Metabox custom field to show checked if value is updated using post meta query?
- How do I update a field of a meta box?
- Input value from metabox is not found in $_POST after post save
- Doubts about the use of metadata and how this can affect performance on WordPress
- update_post_meta not working in a loop
- Get draggable widgets on Edit Post page
- How to get post content by get_posts function?
- Custom code for WordPress dynamic menu
- Why does my widget break other widgets?
- get_posts in meta box dropdown not showing latest posts
- Custom fields for custom post type
- What’s wrong with this post__not_in argument?
- Checked() function on a multidimensional array
- What is the best way to store a few fields?
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- How can I add a simple custom field to my plugin?
- Ajax is not working in a loop
- WP nonce field checkbox prints checked=’checked’ outside input field
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- How to save post meta as an array in Gutenberg?
- per blog metadata for plugin
- How to format custom fields when editing an attachment?
- Using delete_post_meta for deleting multiple selected options
- Get audio metadata on file upload
- Plugin can’t be activated [closed]
- Remove Meta-boxes (Yoast SEO plugin) [duplicate]
- Is there a way to add a link with add_post_meta?
- Adjust query on single
- how to add custom fields into new & update post page?
- Customise Grouped Product display in Woocommerce with custom column
- Why is $_POST empty when saving custom Meta Box?
- Condition to check previous next article post title
- register_meta not showing custom post type metabox data in rest api
- WP_Query not ordering correctly
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Adding customs fields on each product on the cart
- Insert, update or remove data from database (usermeta)
- add_meta_box does not display meta box in Admin
- Unexpected issue when using attachment_fields_to_edit filter
- WordPress delete mysql rows with string
- How to get post that has non zero or greater than zero meta value
- Saving post meta
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- Include add_post_meta in a plugin
- Custom query not working in plugin admin page
- How can i call from custom fields to the category editor?
- How do I query posts and have their related taxonomies returned in the results?
- I want to display the content of a text field only if it has been entered
- Create Unique and Customized User ID for Website Members in WordPress
- Can I log the searches that are returning 404 in the DB?
- filter on get_posts efficiently
- Hook the Keydown Event in the TinyMCE Post Editor
- Custom Meta Box not Saving in Posts with Gutenberg Editor
- Custom url for a plugin page add_rewrite_rule WordPress
- When is the proper time to minify css and js with git workflow?
- Replace first occurence of a word with link [closed]
- update_post_meta not working well