This line is wrong:
'meta_key' => 'adminscore' + 'user_like' + '_count-views_all' + 'comment_count',
'meta_key'
only accepts string value.
What you need is an additional meta key, e.g. “totalscore” that holds the total value of the scores you have for all the meta values. You can manually run a php function that calculates and store the totalscore value from time to time or use wp_schedule_event to run the function on a set interval.
You can then write the $args as such:
$args = array(
'meta_key' => 'totalscore',
'numberposts' => $number_posts,
'post_status' => $post_status,
'post_type' => $custom_post_type,
'orderby' => 'meta_value_num'
);
Related Posts:
- How to get all term meta for a taxonomy – getting term_meta for taxonomy
- Job of meta_key meta_value fields in database tables
- How to get the total number of meta_values based on a custom post type?
- WP_POSTMETA – What do these values mean inside the data structure?
- How can I convert postmeta from unserialized to serialized?
- why after saving meta value it’s saving all the values the one that i clicked?
- Is it safe to add a new field to meta_value field?
- How can I use ‘orderby’ => ‘meta_value_num’ to order by the numerical value even if the value starts with a word?
- Display current ranking of post as a number in post title
- I can not display meta value in extras.php and template-tags.php
- Count Post and Page Views based on meta_value Using Shortcode in Dashboard Widget
- Negative meta_query if storing multiple post_meta values with shared meta_key
- if get_post_meta function returns empty – Do Not Display HTML
- How to get the total of two meta values from different meta keys?
- How to save a meta_value as a numeric value after I retrieve it via update_post_meta?
- How to update/add child posts meta whenever the parent post meta is updated?
- Multiple meta key and value search in the query
- How to sort by meta value num, but ignore zero value?
- How to only display posts whose meta_value field is not empty?
- Explanation of update_post_(meta/term)_cache
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- What is the different between an attachment in wp_posts and an attachment in wp_postmeta?
- if get_post_meta is empty do something
- Meta compare with date (stored as string) not working
- How to update/insert custom field(post meta) data with wordpress REST API?
- Front-end update_post_meta snippet displays white screen?
- Give extra post-meta to RSS feeds
- How to get meta value in wp_attachment_metadata
- Clean up output added via wp_head()
- WordPress Admin Panel search posts with custom post meta values along with title
- Short of raw SQL, can I query for multiple attachment metadata that have a given array key?
- Get post from meta_key and meta_value
- get_post_meta returns bool(false)
- How to get custom post type to display post meta on archive pages?
- Filtering multiple meta_values
- get_post_meta remains empty while looping all menu items and using the ID
- how do I set a schedule event to modify all posts’s meta value weekly or monthly?
- How to stop wp_postmeta from being called on archive and search pages?
- How to use update_post_meta() function properly?
- How to wrap meta values seperated by comma in ? [closed]
- WordPress front-end media (image) upload ERROR!
- Run a check for multiple meta key values
- running function during post save and adding variable to post meta
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- update_post_meta saves nothing in database when run in publish_post
- Can’t access post meta on new post creation (cpt)
- How do I dynamically call a page/post author into the meta data?
- Set Condition echo function get_post_meta
- Custom post meta values reset by autosave [duplicate]
- Compare meta_query with a Regular Expression and do a less-than operation on it
- Is it possible to retrieve a post and its metadata at the same time?
- cleaning up safely wordpress wp_postmeta table
- Post meta as array looks like string instead of array
- Why does get_transient() always return string even if integer set?
- Author_meta ONLY if it exists
- How to test the outcome of a wpdb query?
- Update post meta custom field using block editor
- Print specific values stored in a post meta array
- Is there a way to disable post meta caching for development?
- Get post_meta from specific post [closed]
- update_post_meta not working?
- Change wordpress meta tag description using WP functions
- Cant create or update meta fields using WordPress REST API
- Filter posts by meta key
- delete duplicates wp_postmeta
- Post Thumbnail missing when using webp format while sharing
- Bulk Update Post Meta Values from Different Post via Rest Api
- update_post_meta() is not saving the value
- Only show meta on one post type on search results page
- How to register post meta with multi level arrays?
- If I disable screen options, does WP still try to update post meta?
- Can we have duplicate key pair values in post meta data?
- I created a Custom Meta Box but it is not displaying the value on my post page
- Meta data being pulled from wp-login.php
- Get post content before rendering
- wp_insert_post inside save_post adds wrong metadata to inserted post
- Rename image filename using ‘media_handle_upload’
- Update Post metafield of specific categories
- rendering open graph meta tags in wordpress
- Using Self Hosted Video URL With Custom Fields
- Multiple postmeta values to the same post_id/meta_key combination?
- get_post_meta not work in php foreach
- Restore deleted _thumbnail_id in postmeta table
- Why are my custom metaboxes not updating the post meta?
- Problem serializing single quote and double quote into post meta
- Storing post_meta fields in array
- Performace on 1 million plus meta fields vs 1 field with 1 million multi array
- Fetching array of postmeta with $wpdb and in_array conditional
- Piklist File Upload
- how to echo/display the custom field value in specific custom field name?
- update_post_meta() not working in bulk option
- How to update the ‘modified_time’ of a post ONLY when content is changed?
- Custom Field: Display only if a specific key is selected outside the loop
- Multiple If else statements on Search Result Page
- get_children filter with postmeta
- delete blank space in post_meta empty [closed]
- How to show wordpress post in the site based on custom field value?
- wordpress query making site very slow
- if condition from post_meta not working in save_post
- WP Query Args – search by meta_key or title