Description
This new filter gives developers a chance to show or hide the “Add inline SVG” button programmatically, based upon their own logic.
Parameters
(bool) Whether the block is being shown or not.
Return
(bool) Whether to show the button or not
Example
You may use the filter in any way you like. The example below shows how to restrict adding inline SVGs via the button to admin users.
<?php
add_filter( 'wpsvg_show_inline_editor_button', function () {
// If the user is logged in and has the manage_options capability
// allow them to see the inline SVG button.
if ( is_user_logged_in() && user_can( get_current_user_id(), 'manage_options' ) ) {
return true;
}
// By default, hide the button.
return false;
} );
wpsvg_show_inline_editor_button