8
votes
1answer
287 views

Why are simple updates to wp_postmeta's “_edit_lock” so slow?

In our MySQL slow query log, the cumulatively slowest query is a simple update to wp_postmeta. Here's an example: UPDATE `wp_postmeta` SET `meta_value` = '1392835505:386' WHERE `post_id` = 94705 ...
0
votes
1answer
157 views

Unique Post Meta Values

I want to use Unique IDs like YouTube video IDs and WordPress post IDs in a custom field 'youtube_id'. I just created a front-end add post page and want to check if 'youtube_id' used or not used in a ...
0
votes
0answers
102 views

One-time bulk MySQL copy post_date values to Advanced Custom Field (date field)

Disclaimer First of all let me say this is probably mostly MySQL related and unfortunately I'm nearly a total newbie on database language and commands. The problem Situation is a site running ...
0
votes
1answer
71 views

Group posts by meta_key

I have a Problem with grouping meta_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow array_unique was not successful and also ...
0
votes
0answers
155 views

Using mysql queries to delete custom post types based on meta_value

I am trying to create a cron job to run on my server which deletes a custom post_type (post_type = event) from my databse based on a meta_key (st_date) and a meta_value (the date the event took place ...
5
votes
2answers
234 views

Lack of composite indexes for meta tables

Why wp_commentmeta table does not have a composite index (comment_id, meta_key) by default? I believe it's the only useful index for that table, am I wrong? Instead, it has a strange set of indexes: ...
2
votes
2answers
248 views

Grouping related postmeta data via SQL query

I am using someone else's WP plugin which stores lots of related data in wp_postmeta using an "artificial key". So effectively we hijack wp_postmeta to create a nested relational database. So one row ...
3
votes
1answer
2k views

delete unused postmeta

I love the comment by s_ha_dum : http://wordpress.org/support/topic/sql-query-to-delete-postmeta and havent tried it yet, but Im wondering just how 'clever' this actually is? Does the unused postmeta ...
0
votes
1answer
649 views

mySQL query. ORDER BY meta_key

I'm fighting this quite long already and start to think I'm missing something big. CPT posts could have or not metadata ( _vip_post [0|1], _thumbnail_id [null|numeric] ). If i query for ...
0
votes
1answer
270 views

Export posts with postmeta without ID?

I have some select posts on one database that I need to export and import into a different database. Because both databases are operating independently, there is overlap with post IDs so I can't ...
1
vote
3answers
1k views

MySQL query to set wp_postmeta using term_taxonomy_id value

I have a need to set the wp_postmeta value (in table: wp_postmeta) on every post that has a specific term_taxonomy_id (in table: wp_term_relationships): Specifically: run a query against every ...
0
votes
1answer
770 views

MySQL Query that looks for post with Custom Field, then changes Category

I'm looking for a MySQL Query that will look for all the posts with custom field "meta_key_I_want_to_find", then if the custom field is detected, add a category to that post. The category has already ...
1
vote
1answer
390 views

MySQL Query To Select Post By Postmeta

I have two custom post types, type1 and type2. Type2 posts have a postmeta called postID that is the ID number of a post in type1. When showing type1 in single.php I want a mysql query that selects ...
3
votes
1answer
958 views

importing data from non-wordpress mysql db

I have created an import file to get the articles from a non-wordpress db and bring them in as posts in wordpress, I am not sure how to bring over the thumbnail image into my custom field I defined as ...