The meta_value is not of an integer type for max to return proper values. You can use mysql cast
method to convert into integers as follows:
SELECT max(cast(meta_value as unsigned)) FROM wp_postmeta WHERE meta_key='price'
Related Posts:
- SQL query based on two different custom field values
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Add custom fields to search
- Meta Query And/Or
- Get emails from users by custom field SQL
- Show array of meta_value in Edit Post Coloum
- Making WP_Query limit results by date before today where date is a meta_query
- get posts based on non-single metadata
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Create Shortcode shows only posts with custom_field meta
- WP Query Args – search by meta_key or title
- Using meta query (‘meta_query’) with a search query (‘s’)
- Max length of meta_value
- ORDER BY custom field value
- SQL Query to copy value of a meta_key into another meta_key
- How to correctly call custom field dates into a posts_where filter using SQL statements
- Can I query custom meta data through WP_Query
- How to rename a custom field?
- Matching Serialized Arrays with meta_query
- Meta Query with AND & OR?
- So much data in postmeta
- What is the advantage of the wp_options design pattern?
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- get_pages sort alphabetically by meta value
- Retrieving custom fields with $wpdb->get_results
- Trying to perform complex custom field query with order by set to field value
- Is there a way to do multiple ordering on a multiple meta_query?
- Assign/update the custom field value for all posts
- Bulk move (or copy) from a custom field to the post content?
- Order by custom field date with ASC order
- Up/Down voting system for WordPress
- WordPress Search Custom Meta Field Only
- Custom Fields Bulk Edit
- Compare meta_query decimals not working right
- Ordering posts by anniversary using only day and month
- Calling Specific Pages with wp query Part II
- Loop through two different sets of custom fields
- How to break meta values into different items and avoid duplicates?
- Slow meta query with multi meta keys
- Using OR in WP_Query negates the “NOT EXISTS” compare
- How can I query on the year part of a complete date in a custom field?
- WP_query : meta_key with custom rule for specific value
- How can I combine meta_query queries?
- Displaying posts with only upcoming dates according their custom field date value
- How to filter a dd/mm/yyyy date from a custom field in a query
- Get multiple custom field values in a $wpdb query [duplicate]
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- Sorting posts by multiple values, combined
- meta_value_num sort glitch
- WP_Query display next custom post from today’s date
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- WP_Meta_Query causing long-running MySQL queries
- Sorting posts by custom fields in meta_query
- meta_query for a string inside a meta field containing a comma-separated list
- Order by custom field value not working for acf date field
- How to sort category by custom field value
- trim custom field text value and show (…)
- Get all posts that do not have a specific custom field without using a subquery
- Complex WP_User_Query call fails on production server
- Query post order by post and desc not working
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- Meta query with timestamp using WP_query
- Orderby custom field meta value ASC and then by date DESC
- Order query by meta_value with multiple custom fields
- How to wrap meta values seperated by comma in ? [closed]
- Custom Field Create Bulk via SQL Query
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- How make a custom search on backend in WordPress without plugin?
- How to add a new meta key and assign timestamp to posts
- Get content from pages with same meta_key from Database
- Run a check for multiple meta key values
- Filter by custom field (meta_key) using JSON API
- WP 3.1 meta_query for multiple custom field values
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Removing link ” from ” on meta_value in custom feilds
- Get posts with same meta value as current post
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Alter main archive, to show posts with meta as last
- Meta Query returns wrong number of posts
- Sort alphabetically by custom field
- Change order of posts
- Use meta_query to get title of associated post
- Meta query with multiple custom fields for archives page ordering problem
- filter custom field values $min $max
- Ordering posts by custom field named “date” in backend
- Get Data From wp_sitemeta for Multisite network
- Unique meta_key with array value vs repeated meta_key with single values
- get posts where a custom field contains a text
- WP Query – Is this correct?
- Custom Query based on custom field of a single post
- How can I do a variable for meta_query?
- Avoiding ACF get_field and returning to core WordPress function
- pre_get_posts : only get posts by wp_usermeta value
- ORDER BY custom field value out of where clause
- comment meta_query for keys that aren’t yet set
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- meta_value and meta_key filtering returning no posts [closed]
- IF Custom field value equals ZERO
- List custom field values in alphabetical order without repetition
- Build index page from custom fields