jhtjards
Forum Replies Created
-
Forum: Plugins
In reply to: [Embed Privacy] Bug? Youtube Shorts Preview Image not showingGreat to know, thanks for adding that!
Kind regards
JannForum: Plugins
In reply to: [Embed Privacy] Bug? Youtube Shorts Preview Image not showingAddition:
I’ve noticed that if I use an Advanced Custom Fields Block with an “oembed field”, the embed-privacy thumbnail preview works.
For this type of embedding the resulting youtube player shows the “Shorts” Logo, while embedding via just pasting in the block editor will create a normal web player with the “YouTube” logo.
Might be a useful hint.Oh, it’s working now.
Sorry, I realise now where I was mistaken. It wasn’t one big object, it was all the looped providers sequentially in separate objects. So using get_name() to check for the current provider works just fine.So to allow for the script tag only for google maps the filter looks like this:
add_filter('embed_privacy_replacer_matcher_elements', function($allowed_tags, $provider) {
if($provider->get_name() === 'google-maps'){
$allowed_tags[] = 'script';
}
return $allowed_tags;
}, 10, 2);Within my wrapper function it looks like this:
/**
* Replace specific content with the Embed Privacy overlay of type 'google-maps'.
*
* @param string $content The content to replace
* @return string The updated content
*/
function spielortemap_replace_content_with_overlay($content) {
if (!class_exists('epiphyt\Embed_Privacy\data\Replacer')) {
return $content;
}
$wrapped_content = '<div class="embed-privacy google-maps">' . $content . '</div>';
add_filter('embed_privacy_replacer_matcher_elements', function($allowed_tags, $provider) {
if($provider->get_name() === 'google-maps'){
$allowed_tags[] = 'script';
}
return $allowed_tags;
}, 10, 2);
$content = \epiphyt\Embed_Privacy\data\Replacer::replace_embeds($wrapped_content);
return $content;
}I hope somebody in the future will find this useful too.
Hi Matthias, ah ok, thanks for your clarification regarding script tag in the regex!
And thanks for the performance suggestion. Can you maybe provide an example of how to check for the provider?
When I take the above filter function and var_dump the$providerin theembed_privacy_replacer_matcher_elementshook, I get a huge object of all the possible providers β not just the one used in this instance. I feel like I’m missing a puzzle piece here..Hi Danny,
I haven’t set up wp cli on that site and hoster, so I kept the cron job like described before (using wget and the cron url at https://domain.com/wp-cron.php?doing_wp_cron)After 4 days not touching the site, I can confirm the fix works. Nice aggregation of stats on each day β beautiful.
Thanks again for your help and suggestions!
Hi Danny, thanks for your ideas!
WP Cron seems indeed the culprit. Investigating the error log I foundCron reschedule event error for hook: koko_analytics_aggregate_stats, Error code: could_not_set, Error message: Could not save cron event list., Data: {"schedule":"koko_analytics_stats_aggregate_interval","args":[],"interval":60}There were more errors like this from other plugin’s schedules, so I don’t think koko analytics is at fault here.
I researched a bit and checked file permissions as well as a check for database issues (Did a “REPAIR” and “OPTIMIZE” on wp_options table). I couldn’t find anything wrong. WP Cron runs normal, if I’m logged in.
Maybe a weird server issue (It’s a litespeed server, no caching enabled from within WP).
So next I’ve set up a real server cron job now to run every 5 minutes and disabled wp-cron in wp-config.php.
I’ll report back in a few days if this helped or not.Forum: Plugins
In reply to: [Crop-Thumbnails] cropping no longer possible after update – server error1.9.3 works great for me, thanks again for your responsiveness!
Forum: Plugins
In reply to: [Crop-Thumbnails] cropping no longer possible after update – server error@volkmar-kantor Did you just miss it or is there another reason for not implementing the
rename()atomic-save fix? (Just want to make sure it doesn’t get lost)Forum: Plugins
In reply to: [Crop-Thumbnails] cropping no longer possible after update – server error@volkmar-kantor Awesome! Using rename() solved it! I was not able to produce that error again with your suggested change. So the non-atomic file write really was the problem here.
I’ve also tested this change on a few other servers, including apache powered ones, and it worked in every setting for me + no negative side effects.
Sorry again for hijacking the thread, but at least we’ve quickly squashed a potentially hard-to-get bug.
Good luck to the OP solving their issue! I’ll quietly leave now.Forum: Plugins
In reply to: [Crop-Thumbnails] cropping no longer possible after update – server errorMaybe a naive thought, but could there be a way to wait for the server’s completion of the crop (and save) and only then reload the newly cropped image via ajax in the crop window?
(sorry can’t edit my post above anymore)Forum: Plugins
In reply to: [Crop-Thumbnails] cropping no longer possible after update – server errorTo further contribute to finding the potential bug:
I’ve noticed an intermittent server error when reading the file. Weirdly sometimes cropping is successful, sometimes it isn’t and the thumbnail preview of that size stays empty. (+Error message in console (For GET request))
In these cases my server log says this:2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 18614 of 23955 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-740x212.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-740x212.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 16937 of 32768 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-1480x424.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-1480x424.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 25845 of 32768 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-1664x477.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-1664x477.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 18614 of 23955 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-740x212.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-740x212.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 16937 of 32768 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-1480x424.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-1480x424.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 18614 of 23955 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-740x212.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-740x212.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 5215 of 29599 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-1664x477.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-1664x477.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 16937 of 32768 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-1480x424.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-1480x424.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"
2024/10/21 14:25:58 [alert] 28436#28436: *6975 pread() read only 17980 of 32768 from "/var/www/mysite.com/htdocs/wp-content/uploads/2024/10/my-image-1664x477.jpg" while sending response to client, client: 185.55.**.***, server: mysite.com, request: "GET /wp-content/uploads/2024/10/my-image-1664x477.jpg?cacheBreak=1729513558461 HTTP/2.0", host: "mysite.com", referrer: "https://mysite.com/wp-admin/post.php?post=16&action=edit"Edit:
I’ve downgraded to 1.8.0 in the meantime and am still getting the same error sometimes. My issue seems to be more related to my server setup (which is nginx with “open file cache”) and maybe not related to the op’s problem. (Sorry)
But while we’re here, this is what I’ve found out:
This error seems to be triggered when the image file is accessed while still being modified.
Maybe there can be done something in the way newly-cropped images are saved and then accessed?
I cannot trigger the same error (and I tried a lot) when I use “regenerate thumbnails” by Alex Mills.
Here’s some more context from the nginx forum:It’s not “related” to the “open_file_cache” directive, but the
“open_file_cache” directive makes the underlying problem more
visible.The root cause of the messages in question is non-atomic file
update. Somebody on your system edited the file in question
in-place, instead of re-creating it with a temporary name and then
using “mv” to atomically update the file.Non-atomic updates create a race: a file which is opened by nginx
(and stat()’ed for nginx to know it’s length) suddenly changes.
This can happen in the middle of a response, and results in a
corrupted response – first part of a response is from original
file, and second is from updated one. If nginx is able to detect
the problem due to file size mismatch – it logs the message in
question.The only correct solution is to update files atomically, i.e.,
create a new file and then rename to a desired name.However, the “open_file_cache” directive makes the race window
https://forum.nginx.org/read.php?2,244861,244871
bigger by keeping files open for a long time. Switching it off is
a good idea if you can’t eliminate non-atomic updates for some
reason.Maybe this helps?
- This reply was modified 1 year, 7 months ago by jhtjards.
Forum: Plugins
In reply to: [WPS Hide Login] I cant hide notice after update to 1.9.12Same here. I don’t use Comments on my site and I don’t even make use of the comments template. I’ve used the comment-registration setting to make sure no spam comments via rest or xmlrpc or whatever can get through.
At the moment the plugin only checks for the WP Option ‘comment_registration’ and will popup this message as long as this site option is set.
Please make it actually dismissable or maybe someone has a better suggestion for cases like this?Yep, this works for me!
Thank you!
Hi, have you been able to take a look at this?
I’m seeing more support requests regarding compatibility with (redis) object cache. The above mentioned class is wordpress core, so this might be worth checking, could be an easy fix π
Hi, so my further investigation (and support ticket with a object-cache-helper plugin developer) has confirmed, that this plugin is missing an object cache flush when changing the order of draft posts.
The dev said the following:I’ve taken a look at this and I’ve confirmed the issue you are having. However, our Redis object caching is an implementation of the WordPress object-cache.php drop-in, which means that WordPress determines when the object cache is cleared, we don’t control that. So the plugin developer would need to call one of theΒ WordPress object cache functionsΒ to clear the cache after changing the order.
Could you take a look at this?