Database Errors since site updated to WordPress 6.4.3

The errors were generated because there was a plugin that forced sql modes to be used on the database that are actually “incompatible” with wordpress. The following code was sadly executed for every request… private function set_sql_mode() : void { // Make sure no sql modes can be blocked (By wordpress built-in incompatible modes) add_filter(‘incompatible_sql_modes’, … Read more

wp_http remote request not respecting timeout

I suspect this is the cause in the Requests library that powers WP_HTTP: Transfer & connect timeouts, in seconds & milliseconds cURL is unable to handle timeouts under a second in DNS lookups, so we round those up to ensure 1-999ms isn’t counted as an instant failure. The code looks to be here: https://github.com/WordPress/Requests/blob/90db63ab54449c071fc2192a4fc3487cafbf67d0/src/Transport/Curl.php#L448-L460 if … Read more

‘At a Glance’ dashboard: combining infos

dashboard_glance_items is a filter hook, not an action hook. See here for an explanation of the difference. Your at_glance() function doesn’t include the existing values, so only the items you return will be present in the At A Glance widget items. Something more like this: function at_glance( $items ) { $number_users = count_users(); $text = … Read more

Pre_get_comments and orderby comment_karma

I think you’re close with your 2nd snippet, but you should be using meta_value_num instead of meta_key_num. $query->set( ‘meta_key’, ‘comment_karma’ ); $query->set( ‘orderby’, ‘meta_value_num’ ); See the WP_Query orderby docs for more info.

Remove rel=”ugc” from links in comments

The rel=ugc is added by a default filter on pre_comment_content. You can disable this by adding the following line to your functions.php: remove_filter (‘pre_comment_content’, ‘wp_rel_ugc’, 20); This may not be wise. If at some point you change your mind, you would have to go through all comments to add it. It is problably better to … Read more

ENV for WordPress

As I don’t know why rails prefer to store such secrets in an environment variable the answer might not be complete, but if the reason is to avoid having it in the code and therefor accessible to everybody with access to the code (via git or misconfigured web server), wordpress has two ways to do … Read more

No Google Analytics code rendered in the header?

Thanks @Danijel for providing the link to their github. I’ve played around with the theme and I found that you should make changes here https://github.com/presscustomizr/customizr/blob/dev/templates/head-no-model.php It seems that the code from here https://github.com/presscustomizr/customizr/blob/dev/header.php#L10 is executed and doesn’t reach to your added code. I was able to see the GA script after adding the code in … Read more