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

Add function like remove_pattern() to remove specific pattern #22455

Closed
CreativeDive opened this issue May 19, 2020 · 2 comments
Closed

Add function like remove_pattern() to remove specific pattern #22455

CreativeDive opened this issue May 19, 2020 · 2 comments

Comments

@CreativeDive
Copy link
Contributor

There is currently no way to manage existing patterns. But I think doing this is very helpful. So I am asking for a feature request to add this future functionality. In relationship to the register_pattern() function, it would make sense to define a function like remove_pattern() to remove a specific pattern.

@Soean
Copy link
Member

Soean commented May 19, 2020

There is already a function to remove pattern.

/**
* Unregisters a pattern.
*
* @param string $pattern_name Pattern name including namespace.
*
* @return boolean True if the pattern was unregistered with success and false otherwise.
*/
function unregister_block_pattern( $pattern_name ) {
return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name );
}

PS:
register_pattern() was renamed to register_block_pattern().

@CreativeDive
Copy link
Contributor Author

@Soean This is awesome, thank you very much! Please close this issue :-)

@Soean Soean closed this as completed May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants