At the stage of retrieving posts from database this is impossible (or at least impractical), since arrays are stored serialized by PHP in meta table and SQL won’t be able to process them on the fly effectively.
This is easy enough to do for specific set of posts retrieved, just sort results in $mostsharedposts->posts
before output. But that won’t give you sane continuous pagination in that order.
In a nutshell if you want this in reliable non–hacky way, you will likely want to break out copy of that value in array into separate meta field.
Related Posts:
- How to only display posts whose meta_value field is not empty?
- Can wp_query return posts meta in a single request?
- order by numeric value for meta value
- How do I query for posts by partial meta key?
- WordPress retrieving meta data for all custom post types in list view
- Order by optional meta key?
- meta_query: using BETWEEN with floats and/or casting to DECIMAL
- Reduce or prevent calling of update_meta_cache
- What is the most efficient way of querying posts based on visits and date for current day?
- WP_Query displaying ALL posts
- Query Custom Meta Value with Increment
- WP-CLI How to generate a list of posts with corresponding meta values
- What is an efficient way to query based on post_meta?
- How to count post meta key values for all posts in database
- How should I use posts_where to change meta_value from a string to integer?
- How can I create a WP_Query that returns posts where one meta_value
- WordPress altering my custom query, How to fix it?
- WP Meta Query for some meta (array) values
- WP Query post meta value
- Would this post meta be better added to the post table rather than post_meta table
- query posts in functions.php and update a field
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- how to fire join query with post_meta
- Best approach to create Hot and Trending sections
- WP_Query, custom sort and custom filter
- Order posts by meta value and Date
- How to make orderby ‘meta_value_num’ OPTIONAL?
- Query Posts depends on custom field inside repeater field using acf
- Minimising Database Queries when using Advanced Custom Fields
- Get meta info related to current post
- Select from wp_post and multiple meta_value from wp_postmeta
- Pull post meta with post_query?
- Group WP_Query by meta_key date
- WP_query posts closest to todays date
- exclude posts with a specific custom field and value
- Inserting serialized value into wp_postmeta using update_post_meta
- How to make Meta Query case sensitive?
- Performance when getting post meta for post retrieved by meta value
- Get attachment by meta_key value
- Display custom field meta outside loop, site wide
- Using hook to use DISTINCT in a wp_query
- Where to put meta Keys
- how to make members list directory through wordpress post custom meta key.
- How do I query for posts by partial meta key?
- Large AND OR query timing out
- get_post_meta slowing down my page load (in a plugin)
- New WP_Query loop in admin causes problems
- echo a specific meta_key queried through a custom post
- How to increase load time of an archive/search page (WP_Query)
- get_post_meta in WP_Query
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- Hide posts with meta key in WP_Query
- Filter posts by comparing custom meta value against postdate
- WordPress query posts with multiple post_meta data
- WP_Query – Accessing MetaValue from Query Result
- search serialised meta_value for date value?
- How do I check if an article is popular this week?
- Woocommerce: order posts by meta key
- Order WP_Query results by meta key value in custom query
- How can I update post meta inside a WP_Query loop or the WordPress loop?
- Nested array issue in meta_query
- Display post meta conditionally based on it’s value
- Filtering by multiple conditions in the loop
- Orderby two meta fields not working
- Query posts by searching for a string in a meta field
- WP_Query meta compare must include ALL array values
- How do i create a custom post query when the meta value is an array?
- wp query to use both author id and meta_query
- Sort by price wpdb
- Trouble with serialized metadata
- show most viewed post
- Display posts from multiple value in meta separated by comma
- Custom filter from post meta
- Why can my filter query SOME metadata but not other metadata?
- update_post_meta performance in a loop woocommerce
- update_post_meta performance in a loop woocommerce
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- I need query_posts() to order results first by a meta value and then by post ID
- Look for string in posts and postmeta
- Query postmeta based on meta_value, return array of post_id
- I can’t get post based on its postmeta value and key
- Saving custom fields for WP_Query to retrieve
- Meta key in wp_query bug?
- How to show all the associated posts with specific date of data metabox?
- WP Meta Query at depth 2
- WP_Query with child element
- WP_Query Posts by Metadata from Option Tree
- Sorting Posts with meta value not working
- How to get several fields from wp_query?
- WP Query to order posts by multiple meta fields
- Return a single custom post from multiple meta queries
- Custom Search Query – include only custom fields and title
- How to count post meta key values for all posts in database
- loop through custom post types with meta data
- query by meta value then date and not empty meta value
- wordpress sorting using array merge by price in ascending order but price with 0 must be show last
- Query posts by meta value and sort by another meta key
- WP_Query by meta key not returning any posts
- Extend search query to search meta keys values based on search string
- How to get posts that have certain meta key value and order based on another meta key’s value