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:
- 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’)
- 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
- Meta Query with AND & OR?
- 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?
- 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
- Custom Fields Bulk Edit
- Ordering posts by anniversary using only day and month
- Calling Specific Pages with wp query Part II
- Slow meta query with multi meta keys
- Using OR in WP_Query negates the “NOT EXISTS” compare
- 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
- WP_Query display next custom post from today’s date
- WP_Meta_Query causing long-running MySQL queries
- 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 (…)
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- Meta query with timestamp using WP_query
- 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
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- 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
- Use meta_query to get title of associated post
- get posts where a custom field contains a text
- WP Query – Is this correct?
- 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
- 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
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- Update post meta custom field using block editor
- How to add custom filed value after in wp post title
- Sortable Custom Columns not sorting correct
- Meta_query ‘compare’ => ‘LIKE’ not working?
- Diamond question mark in text after migrating content
- query_posts with meta_value
- Help setting up a sql query
- SQL: Select wordpress posts with given text string and add a custom field to them?
- Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- multiple meta_query and orderby question
- User query – getting values for custom meta keys/fields
- Set class if a meta value is set within post archive
- WP meta_query args not working in function
- Filtering posts by ACF meta query
- Why does my numeric meta query work only on one meta key and not the other?
- SQL query to change the value of a Custom Field
- meta_query to check all custom fields
- 4 Unique Random Posts based on Custom Field Values
- Update custom table on metabox POST
- Fastest and most efficient SQL query to check if UID exists
- Query postmeta values, and return multiple post_titles for common meta value
- Query Posts Via WordPress URL
- Custom Field: Display only if a specific key is selected outside the loop
- query specific posts according their custom fields, using sql SELECT
- Meta_query not filtering posts
- Dynamic background image used in css after selector
- Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)
- get Custom field label (select/dropdown) on front end
- Block Editor – Meta values not saved, meta changes to empty array on update
- Sort posts based on an acf field called fecha value return longtext ‘20240517’
- Query ‘orderby’ when there are multiple values for the same meta_key