Export SQL query based on custom field?

Change your query to: SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON wp_postmeta.post_ID = wp_posts.ID WHERE ( wp_postmeta.meta_key = ‘Color’ AND wp_postmeta.meta_value IS NOT NULL ); That way it only gets the data in wp_posts, but still filters based on your criteria.

Phpmyadmin – post editing

Mysql allows you to run queries that apply to all post, see example : UPDATE wp_posts SET POST_CONTENT = replace(POST_CONTENT, ‘<a href=”http://mysite.com/my_link”>mylink</a>’, ”); This code allows you to delete <a href=”http://mysite.com/my_link”>mylink</a>on all posts. But in your case I doubt all links are the same so you need a pattern. Perhaps it can be done with … Read more

SQL: Select wordpress posts with given text string and add a custom field to them?

Here you go (you’re really close): INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT ID AS post_id, ‘customer_reviews’ AS meta_key, ‘On_or_delete’ AS meta_value FROM wp_posts WHERE wp_posts.post_content LIKE ‘%Customer Reviews%’ AND wp_posts.post_type=”post”; ` Edit: You could also just change IS IN to IN. I rewrote the from part of the query since a subquery was unnecessary … Read more

How to track who has deleted files

WordPress does not log anything natively. Closest it has to such functionality are just post revisions and ability to enable logging of PHP errors. There are plugins around to log events, but since you hadn’t one installed in advance it won’t help you retroactively. If you think it was from action by logged in user … Read more

wp_option table error while importing

I was able to solve my own problem, while its was a very struggling effort.If your database is corrupt, but you want to restore your site. Just open your database in a any program like TextEdit, Notepad++ and make sure you copy the basic databases mention here in a new database, that will at least … Read more

Using mysql to replace img src?

This feels like it is too link-heavy for an answer, but oh well. You can either use the Velvet Blues Update URLs plugin or the Serialized Search and Replace script. Either will allow you to search for a string in the database and change it to something else. The former lets you do it from … Read more