Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Patterns tab #64090

Open
2 tasks done
christofervas opened this issue Jul 30, 2024 · 10 comments
Open
2 tasks done

Disable Patterns tab #64090

christofervas opened this issue Jul 30, 2024 · 10 comments
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Question Questions about the design or development of the editor.

Comments

@christofervas
Copy link

christofervas commented Jul 30, 2024

Description

I use the following code to disable the Pattern directory but after upgrading to WordPress 6.6.1 the Patterns tab is showing even without contain any patterns. Is this a bug?

https://developer.wordpress.org/block-editor/how-to-guides/curating-the-editor-experience/disable-editor-functionality/#disable-the-pattern-directory

I also use the following:
add_filter( 'should_load_remote_block_patterns', '__return_false' );

Step-by-step reproduction instructions

Add the following code. The Patterns tab is still showing up.

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

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@christofervas christofervas added the [Type] Bug An existing feature does not function as intended label Jul 30, 2024
@Mamaduka Mamaduka added the [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced label Jul 30, 2024
@carolinan
Copy link
Contributor

Hi
These code snippets only disable the patterns added by WordPress core, and the patterns from https://wordpress.org/patterns/.
Not the ability to manage patterns added by users, themes or plugins.

@christofervas
Copy link
Author

Hey @carolinan thanks for clarifying this. Is there any way to disable the Patterns tab? Even on a clean installation with no patterns installed from theme, core, user etc. the Patterns tab is still shown with a notice "No results found."

@carolinan carolinan added [Type] Question Questions about the design or development of the editor. and removed [Type] Bug An existing feature does not function as intended labels Jul 30, 2024
@carolinan
Copy link
Contributor

I don't have the answer off the top of my head but it would probably be about changing the permissions for different user roles.

@fgbarrios
Copy link

fgbarrios commented Sep 13, 2024

The code provided didn't worked for me. This one did worked:

function remove_menus_appearance_patterns(){  
    // Appearance > Patterns  
    remove_submenu_page('themes.php', 'site-editor.php?path=/patterns');  
}  
add_action('admin_menu', 'remove_menus_appearance_patterns');

@carolinan
Copy link
Contributor

The code above only removes the menu item from the WordPress admin menu.
Not the patterns tab.

@Codeyak
Copy link

Codeyak commented Oct 4, 2024

I have run into this as well. Up until WP v6.6 (Gutenberg v18.5, I think), removing theme support for 'core-block-patterns' did the trick. Now I need to use a CSS hack, which is never reliable. As new versions role out, it's not uncommon for classnames to change.

(On a side note, not related to this ticket, would also like to remove the Media tab, too)

@meksone
Copy link

meksone commented Nov 11, 2024

I have run into this as well. Up until WP v6.6 (Gutenberg v18.5, I think), removing theme support for 'core-block-patterns' did the trick. Now I need to use a CSS hack, which is never reliable. As new versions role out, it's not uncommon for classnames to change.

(On a side note, not related to this ticket, would also like to remove the Media tab, too)

I'm confirming this behaviour: it's important to clean Gutenberg interface for customer's site; actually doing through CSS

@carolinan
Copy link
Contributor

Can you all add more detailed information about what part of the UI you are looking to hide? It is unclear if the same parts of the UI are being discussed here.

@meksone
Copy link

meksone commented Nov 12, 2024

Can you all add more detailed information about what part of the UI you are looking to hide? It is unclear if the same parts of the UI are being discussed here.

Hi, thanks for asking :)
I think we are discussing this section of the interface (at least, I want to hide this part):
Image

@snibe
Copy link

snibe commented Dec 4, 2024

I am running into the same thing, did anyone ever get a solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Question Questions about the design or development of the editor.
Projects
None yet
Development

No branches or pull requests

7 participants