Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Fabian Todt

    (@gaambo)

    Oh, you are right, my workaround was only half-baked: Since my function has a return type of array we still can’t return null as 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;
    }
    Plugin Author Fabian Todt

    (@gaambo)

    This seems to happen when a null-value is returned from any listener hooked into the posts_results filter. According to the docs the $posts argument/return value can only be an (possible empty) array of WP_Post objects. 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 of count of 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.php function filter_posts_query on 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_Query object. This object’s $posts property 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!

    Plugin Author Fabian Todt

    (@gaambo)

    Hi, 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_key added as query string:
    https://github.com/gaambo/sharable-password-protected-posts/blob/9720850942be56267e456cfc139235dd5feb81d8/includes/functions.php#L111

    Thread Starter Fabian Todt

    (@gaambo)

    My 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!

    Thread Starter Fabian Todt

    (@gaambo)

    I’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.
    Thread Starter Fabian Todt

    (@gaambo)

    I 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.

    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.

    Plugin Author Fabian Todt

    (@gaambo)

    I 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 🙂

    Plugin Author Fabian Todt

    (@gaambo)

    Hi,
    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.
    Plugin Author Fabian Todt

    (@gaambo)

    I 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?

    Thread Starter Fabian Todt

    (@gaambo)

    You 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?

    Thread Starter Fabian Todt

    (@gaambo)

    Okay, thank you. But doesn’t the doc for getEditedPostAttribute “unsaved edit if one exists” suggest, that also unsaved edits will be returned?

    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.

    Thread Starter Fabian Todt

    (@gaambo)

    Yep, previews are working and showing the correct thumbnail. Thank you for the fast response.

    Thread Starter Fabian Todt

    (@gaambo)

    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 function is_user_logged_in called in restrict_media_library is not defined.

    But I think I explained the problem well:
    This plugin calls is_user_logged_in which 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 a function_exists conditional – 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).

Viewing 15 replies - 1 through 15 (of 16 total)