• Resolved Erik Joling

    (@ejoling)


    Hi,

    Since this plugin was featured on WP Tavern I use it with great appreciation. Thank you for your work.

    I have a request: I like block patterns, but I don’t like the ones WordPress includes by default. I could disable them by using the following code in my themes:

    
    add_action('init', function() {
        remove_theme_support('core-block-patterns');
    });
    

    But I would like an option to turn them on/off in an admin setting. This way, site admins can enable them if they want to.

    Is this an option you might consider for your plugin?

    And as a side-question: it would be nice if the No Nonsense plugin had some hooks to extend the functionality. Is this something you have thought about?

    Kind regards,
    Erik

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thanks for suggesting this. I am actually working at the moment on developing my first block theme. (I was one of the anti-Gutenberg holdouts for a long time.) I’ve just been exploring this exact setting with my block theme over the past week, and I do intend to add it to the next update of No Nonsense.

    Thanks for the suggestion about hooks as well. Are you thinking you’d want to have a way to add more items to the settings page so you’d be able to turn your options on and off? Or do you just want to have a way to hook in your own functions?

    If it’s the former, then I do think that would make sense to add a hook to the plugin. If it’s the latter, I don’t think you’d really gain much benefit from that, as it would just be another layer of abstraction that isn’t really any easier to work with than just writing your own hook functions.

    Turns out I was actually ahead of myself… I had already put this feature into my working copy of the plugin source code last week. (It slipped my mind because I’ve been extremely busy with other work recently.)

    I just needed to test it and update some text strings. I took care of that this morning and it’s in the latest version (2.2.0) which should be available shortly.

    Tip for anyone who wants to just code this directly instead of using the plugin: I discovered last week that if you use the default priority of 10, it doesn’t entirely work: most of the core block patterns are removed, but there are still a couple of them that show up under Buttons and Query. Setting priority to 9 or lower fixes it:

    add_action('init', function() {
        remove_theme_support('core-block-patterns');
    }, 9);
    Thread Starter Erik Joling

    (@ejoling)

    Thanks! I’m patiently waiting for the next update 🙂

    Are you thinking you’d want to have a way to add more items to the settings page so you’d be able to turn your options on and off?

    Yes, exactly this. Imagine you as the developer of this plugin don’t want to include the feature to disable core blockpatterns. With a hook I would have the possibility to add it myself.

    I haven’t really dived into the architecture of your code, so I don’t know how complicated it might be. But I’ll gladly help.

    Ah, now that’s a possibility I hadn’t even considered: adding a way for devs to hardcode one of the settings (either on or off), and hide it in the admin interface. Yes, I think that would be a good feature to add.

    Thread Starter Erik Joling

    (@ejoling)

    I think we misunderstand each other, but both additions would be nice 😀

    I see three possible extensions:

    1. Allow developers to add their own options to the admin interface.
    2. Allow developers to disable/enable options by using code.
    3. Allow developers to hide some features

    For me, the list is ordered by what I think is most important.

    Let me open a different topic for this.

    I think we’re on the same track, but maybe I’m just not explaining myself well. I’ve started building out some elements of this, which cover exactly the three things you outlined here.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Feature request: disable core block patterns’ is closed to new replies.