This SQL request call all time and overload my server : SELECT meta_value FROM wp_sitemeta WHERE meta_key = ‘wp_installer_network’ AND site_id = 1

What is it It’s most likely a part of the WPML. This is based on a quick copy paste of wp_installer_network into the github search box. There’s also a small chance this is the Types plugin, but you mentioned you had a multilingual plugin installed. No references to wp_installer_network are found in WordPress itself. and …

Read more

SQL query to retrieve the number of WordPress posts with all given categories

There is a working example that only counts posts that are associated with both categories. This is tested with 3 posts, not 5000. function count_posts_with_categories($cat_ids) { global $wpdb; $cat_count = 0; // A subquery to get all posts that are assigned to each category $subquery = “SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (” . …

Read more

Change permalinks in posts via SQL

If you are using MySQL 8 and above you can use REGEXP_REPLACE, e.i. UPDATE `wp_posts` SET post_content=REGEXP_REPLACE(post_content, ‘domain.tld\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/’, ‘domain.tld/’) WHERE post_content REGEXP ‘domain.tld\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/’; this would look for exact match domain.tld/{4 digit int}/{2 digit int}/{2 digit int}/ then replace it with domain.tld/ so it will replace something like domain.tld/2000/01/01/my-cool-post/ to domain.tld/my-cool-post/ Another option if you cannot …

Read more