Fabian Todt
Forum Replies Created
-
Forum: Plugins
In reply to: [Private Post Share] Plugin has an impact on Ajax search liteOh, you are right, my workaround was only half-baked: Since my function has a return type of
arraywe still can’t returnnullas value. So the correct workaround would be:// Fix for plugins returning null values.
if( empty( $posts ) ) {
return [];
}
// NOTICE: Code below is untouched.
// Only handle single views, don't handle not-found posts.
if ( count( $posts ) !== 1 ) {
return $posts;
}Forum: Plugins
In reply to: [Private Post Share] Plugin has an impact on Ajax search liteThis seems to happen when a null-value is returned from any listener hooked into the
posts_resultsfilter. According to the docs the$postsargument/return value can only be an (possible empty) array ofWP_Postobjects. Seems the plugin is passing a null value. I’m not using strong typing on the function parameters, because I’ve seen this when plugins return values with types that should not be allowed. But I guess the usage ofcountof course breaks when the value is not an array.I could of course check for null values before using count. But that would be me fixing something that should not happen. The docs clearly state the type of the filter’s arguments/return value, and other plugins/code should not return a null value there. I would suggest talking to the devs.
If you want a quick fix for your site:
In my plugin inside
includes/posts.phpfunctionfilter_posts_queryon line #49 change the following to the code beneath:if ( count( $posts ) !== 1 ) {
return $posts;
}if ( empty($posts) || count( $posts ) !== 1 ) {
return $posts;
}For the other plugin:
The “Ajax Search Lite” plugin hooks into the same filter and returns the result of its custom
ASL_Queryobject. This object’s$postsproperty is untyped and could therefore be anything. The developer(s) should add code to catch non-array values and return an empty array instead (imho).Hope that helps!
Forum: Plugins
In reply to: [Private Post Share] URL stored in DBHi, thank you for the feedback!
The URL is not stored in the database, but dynamically built. It’s just the post’s original permalink and the
_sppp_keyadded as query string:
https://github.com/gaambo/sharable-password-protected-posts/blob/9720850942be56267e456cfc139235dd5feb81d8/includes/functions.php#L111Forum: Plugins
In reply to: [Brevo - Email, SMS, Web Push, Chat, and more.] Web push enabled by defaultMy wish would be to disable the dashboard widget and the meta box, when the feature is not enabled. I understand those can be handy, when web push is used – but that’s not the case. I can hide the widget and meta box manually (for every user) or write code to disable them, but still.
You’re right, it does not “affect core website functionality”, but it massively clutters the wp-admin experience on every screen for a feature that is not enabled.
Thank you for the quick update though!
Forum: Plugins
In reply to: [Brevo - Email, SMS, Web Push, Chat, and more.] Web push enabled by defaultI’ve updated the plugin to 3.2.1:
- ⚠️ WP Admin Bar item is still visible by default
- ✅ Can be disabled by going to Web Puh settings and clicking “hide wp admin bar item”.
- Imho this should be opt-in and hidden by default.
- ⚠️I can only “activate” web push in setings but not disable the complete functionality.
- ⚠️Brevo web push meta box is visible by default on all content pages in high priority on side. Please remove this.
- ✅Yoast SEO Metaboxes and primary term functionality seem to work correctly again.
Forum: Plugins
In reply to: [Brevo - Email, SMS, Web Push, Chat, and more.] Web push enabled by defaultI also don’t see a new version of the plugin for updating or on the repository page – still says 3.2.0 from 1 week ago is the newest one.
Forum: Plugins
In reply to: [WooCommerce] New payments admin menu entry? What for?I can only agree with OP here.
I also found this Github issue: https://github.com/woocommerce/woocommerce/issues/39668
It was closed, allthough the menu item is still there. But at least it contains code snippets to remove it.
Forum: Plugins
In reply to: [Good Slider] Cover block width not working properlyI understand, thank you for the feedback! I looked into it and overlay UI is kind of complex and something I don’t want to implement in the custom block myself.
I will have a look into better supporting the cover block inside the slider. As a quick workaround, you can put a cover block inside a slide and apply the following CSS in your (child) theme/custom CSS in site editor:
.wp-block-good-slider .wp-block-good-slider__slide > .wp-block-cover {
width: 100%;
align-self: stretch;
}This will make a cover block stretch the full width/height of your slide. I have not tested this extensively. But in a quick test it worked well enough.
I’ve also opened a GitHub issue here and here to track this. But I can’t promise any timeline atm. PRs are welcome though 🙂
Forum: Plugins
In reply to: [Good Slider] Example extending functionality with phpHi,
I’ve added another example which uses the swiper options filter here: https://github.com/goodwp/good-slider/blob/main/examples/filters.php and also added a notice to the FAQs in the readme.- This reply was modified 1 year, 7 months ago by Fabian Todt.
Forum: Plugins
In reply to: [Good Slider] Cover block width not working properlyI can confirm this in a quick test. The slide block does not support the align/alignWide block support because (if I remember correctly) it somehow messed with swiper styles.
But I tried to make the slide block work similar to the cover – it has most of the same block supports: background color, background image, spacing, dimensions, content position etc. Is there something you are missing?
Forum: Fixing WordPress
In reply to: block.json selectors supportYou have specified several selectors
The code block above shows two “selectors” keys, because that were the two variants I tried. The first one directly sets one selector for the whole “typography” block support, the second one sets a root selector for the typography block-support and a special selector for the fontSize “subfeature” (as it’s called in the docs).
I’ve just tried it with Gutenberg 17.6.0 and also disabled Gutenberg and tried it again. None of the two ways above worked.
I also don’t see any code inside the block support apply functions that would use the selectors. That’s why I thought, maybe it’s just for global styles but not for single block instances?
Forum: Developing with WordPress
In reply to: Difference between useEntityProp and getEditedPostAttributeOkay, thank you. But doesn’t the doc for
getEditedPostAttribute“unsaved edit if one exists” suggest, that also unsaved edits will be returned?Forum: Plugins
In reply to: [ACF Content Analysis for Yoast SEO] Text length: The text contains 0 words.See this GitHub issue – seems to be connected to using classic editor (which I am because I use it for flexible content fields). I remember there was a similar issue a while back.
In the GitHub issue there’s also a code snippet for a workaround via functions.php.Yep, previews are working and showing the correct thumbnail. Thank you for the fast response.
Thanks for your reply.
I can’t – I only tested the update locally before deploying it to the live site. The error log was just a normal fatal error that the functionis_user_logged_incalled inrestrict_media_libraryis not defined.But I think I explained the problem well:
This plugin callsis_user_logged_inwhich is (according to documentation) a pluggable function and isn’t ensured to be loaded when you call it too early. Since this plugin calls it directly in a hook (pre_get_posts) and it’s not completely sure when this hook is called (because it get’s called in every WP Query not only in the main query) it should check if the function exists. Because some plugins (like the mentioned Broken Link Checker) make a WP Query before this pluggable function is included. Wheather that is correct behaviour of these plugins (or any other code which does it) to make a query before init is not important imho, because they do it (and I’ve seen it elsewhere as well).
Therefore a quick fix to be compatible with any plugin which does it and adhere to the documentation I encourage and ask you to wrap the call in afunction_existsconditional – or as an alternative check if the current query is even the right query the plugin is after (as I see it’s only meant for media queries).