Change featured image urls in database

The featured image is stored in the *_postmeta table under the _thumbnail_id key. In fact, chances are that you’ve got a lot of image/media urls in that table, which you haven’t changed. The problem is that a number of things are stored in serialized arrays and changing them with SQL as above will (probably) break … Read more

HTML Entities in Post Title

It seems like the crux of the question is this: This causes the first ‘if’ condition to return TRUE and it inserts a duplicate post. Check for the post_name instead. That value is normalized to lowercase and dashes by sanitize_title_with_dashes so you won’t have this issue. That value is also the one that WordPress enforces … Read more

wpdb_prepare with multiple or condition

I think your first partial code be this partial code: $wpdb->prepare( “SELECT * … from … WHERE ( post_title LIKE ‘%%%s%%’ or post_content LIKE ‘%%%s%%’ )…, $string, $string ); You have to have to pass the same number of arguments into the query as you specify (with %s) in it.

Strange wordpress slowness

You can use the plugin Debug Objects and his query function to identify the slowest queries from core and plugins. I see very often the problem on a plugin or theme functionality. Identify and solve.

Reset/Reorder posts ID in the MySQL wp_posts table

If you want sequential numbers for your posts, then don’t use the post ID column. AUTO_INCREMENT is meant to provide unique numbers (and split-brains in multi-master replication), it is never going to be without gaps, especially not in WordPress (revisions, autosaves, pages, contact forms, galleries and a bunch of other plugins) and especially not with … Read more

How do I properly update the WordPress database password?

This is technically challenging. WordPress must have access to your DB password in plain text. Having access to the wp-config.php contents is already a breach of security in progress. There are alternate approaches to configuration, such as loading credentials via environment variables, but in practice they are used exceedingly rarely because PHP’s configuration file is … Read more

Error while importing database

When exporting from original database you should choose to create the tables if they dosn’t exist (First error). If you didn’t choose that option (in phpMyAdmin that option exists, not sure in other database tools), the import file can not create the tables for your and you need to create then prior to start importing … Read more