The _wp_attachment_metadata
stores serialized data. It’s not meant to be used directly in queries to match results. Instead hook add_attachment
action and store original image’s dimensions into separate post meta properties. After you’re happy with how it works follow Rarst’s advice and find a way to walk all existent image attachments and generate those meta data for them also.
Related Posts:
- Many slow queries post_type = ‘attachment’;
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- How to use mysqli_query() in PHP?
- Access Denied for User ‘root’@’localhost’ (using password: YES) – No Privileges?
- MySQL Error “Operand should contain 1 column”
- How to use MySQL DECIMAL?
- MySQL ERROR 1290 (HY000) –secure-file-priv option
- MySQL server startup error ‘The server quit without updating PID file’
- MySQL ERROR 1045 (28000): Access denied for user ‘bill’@’localhost’ (using password: YES)
- How do I quickly rename a MySQL database (change schema name)?
- What does SQL Select symbol || mean?
- PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused
- Mysql: Setup the format of DATETIME to ‘DD-MM-YYYY HH:MM:SS’ when creating a table
- Duplicating a MySQL table, indices, and data
- mysql Foreign key constraint is incorrectly formed error
- Access Denied for User ‘root’@’localhost’ (using password: YES) – No Privileges?
- ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
- SELECT * FROM multiple tables. MySQL
- mysql: SOURCE error 2?
- java.sql.SQLException: Access denied for user ‘root’@’localhost’ (using password: YES)
- How to avoid MySQL ‘Deadlock found when trying to get lock; try restarting transaction’
- ERROR 1452: Cannot add or update a child row: a foreign key constraint fails
- MySQL foreach loop
- How to find MySQL process list and to kill those processes?
- MySQL IF NOT NULL, then display 1, else display 0
- MySQL Calculate Percentage
- Repair all tables in one go
- How can I output MySQL query results in CSV format?
- Error: select command denied to user ‘
‘@’ ‘ for table ‘ ‘ - Get the new record primary key ID from MySQL insert query?
- How to change collation of database, table, column?
- Failed building wheel for mysql-python
- MySQL Error 1215: Cannot add foreign key constraint
- ERROR 1115 (42000): Unknown character set: ‘utf8mb4’
- Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
- Remove Primary Key in MySQL
- How to get the max of two values in MySQL?
- mysql: connection refused when trying to connect to localhost using remote IP
- Error: Duplicate entry ‘0’ for key ‘PRIMARY’
- Why are simple updates to wp_postmeta’s “_edit_lock” so slow?
- Complex meta query with 3 keys
- How can I find the source of slow queries in WordPress?
- How to log mysql errors from wordpress core?
- $wpdb and MySQL Create Trigger
- wpdb Custom Meta Data with 2 conditions
- query to create woocommerce products from images
- Error: MySQL shutdown unexpectedly. XAMPP local conf running WordPress
- Configure WordPress to connect to Mysql DB using SSH tunneling
- How to Create a Admin User for A WordPress Site via MySQL (PHPMyAdmin)?
- Rewrite database urls
- SQL error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’ [closed]
- Error while importing database
- Migrating from Existing MySQL Setup to WordPress
- How to split the a table in database?
- Why my wordpress loopback traffic while socket is setup?
- How do I join a $wpdb query with user meta using default value if not exist?
- mySQL statment count of post in each category and sub category
- Paypal Post IPN handeling nightmare
- Defining the same price to all WooCommerce Products
- Database Structure on Different Servers
- Is there a page length limit?
- WordPress tables and aliases?
- What’s the sql for this condition?
- Create a form with custom autocomplete address field and CSV import values
- WordPress insert query is not working : Showing no Error
- Copy usermeta value where ID matches in the same table
- Export Yoast Keywords from MySQL/phpMyAdmin
- Some Post Content Does Not Show Up In DB Search
- How can I write a formal sql query to get data from a custom table
- How to fetch all meta_key and meta_value using post_id wihout duplication of post meta using sql query
- Upgrade DB Loop – WordPress DB Version Conflict
- How can I view my site directly from WordPress dashboard?
- (WP List Table) How to sort by SKU and Custom Fields?
- Word Press and database from another server sync
- MySQL ‘duplicate entry’ error
- User set date and time from frontend doesn’t get stored into database
- get posts whether meta_key exists or not
- How to run SQL query from WordPress ‘WP Crontrol’ plugin
- How to bulk delete a certain part of all wordpress posts
- When I add metadata, metavalue length is added in to the value in some cases
- Changes not being reflected on new server
- How to show result of sql query in a page?
- update_option returns false in AJAX, how to debug?
- WordPress database error Duplicate entry for key ‘slug’
- Query does not filter duplicate _sku numbers
- Ordering topics by most replies in X days using MYSQL statement
- MySQL Select within WP Page template
- wp_postmeta – lot of meta fields
- Running WordPress from MySQL Cluster with HAPRoxy
- Delete posts with word count less than x number of words
- MySQL: get post_tag items that are tags (not SEO keywords)
- $wpdb->get_var returns 0
- cannot log in to the mysql server (wamp and wordpress)
- SQL command to export post_content from wp_posts using phpMyAdmin
- Initialization of table in database using ‘CREATE … IF NOT EXISTS’
- mysqldump throws: Unknown table ‘COLUMN_STATISTICS’ in information_schema (1109)
- How do I load a sql.gz file to my database? (importing)
- How to find source of these strange SQL queries?
- Batch Replace URLs in WordPress Database
- How to reduce uncached page generation time?