“#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup

The post_date default value is 0000-00-00 00:00:00. If you check the sql_mode variable like this: show variables like ‘sql_mode’; … it will show you the sql_mode variable, that will be sth like this: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION You have to set up again sql_mode variable without NO_ZERO_IN_DATE,NO_ZERO_DATE So in the previous example you should set the sql_mode like … Read more

WP_Options ID high

I had a similar issue on another site recently, memory usage was through the roof. When I checked the db, wp_options was about 80megabytes. Running this SQL reduced the entire db to 15mb: DELETE FROM `wp_options` WHERE `option_name` LIKE ‘%_transient_%’ Obviously, replace wp_ with your table prefix.

prepare() not working

I agree with @bainternet. You don’t need $wpdb->prepare. There isn’t any user supplied content. The answer to the question is that to get a wildcard % to pass through prepare you need to double it in your code. LIKE ‘_transient_wb_tt_%%’ Try that or this if you want a good look at the generated query: var_dump($wpdb->prepare(” … Read more

How might I retrieve a featured post image from an external WP site and display it as a link back?

Whenever I’m trying to link two sites, I find the most efficient and least destructive way is to use the WordPress XMLRPC API. http://codex.wordpress.org/XML-RPC_WordPress_API/Posts In this case, you could pull this info through using the built in IXR_Client library. This saves a ton of time writing code and trying to mix databases. If they wind … Read more

Presentation vs Content in WP DB-Tables

Is there a clean separation between the WP tables involved with presentation vs content? I would say “no”. There is no clean separation. There is mostly-separation. Most of your content is in the post and taxonomy tables, and most of your presentation is the options table. But you also have things like sticky post IDs … Read more