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

Load posts via AJAX without draft status

admin-ajax.php is treated as part of the admin, so protected statuses will be included. To solve this just explicitly define post_status as publish to only get published posts: $args = array( ‘post_type’ => ‘project’, ‘post_status’ => ‘publish’ ); Or, better yet, consider using the REST API for AJAX requests, instead of the aging admin-ajax.php approach. … Read more

How to figure out correct wp_options to have autoload=’yes’

WP-Rocket was deactivated, but the wp-content/object-cache.php file was still present. This file redefined the wp_cache_add in such a way that the method didn’t work, so all requests to get a single option value were resulting in a query to the wp_options table. I deleted the wp-content/object-cache.php file and the page response time dropped to 2 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)