Set a Custom Capability for Unloading Translations

Since version 1.3.9 of Toolbar Extras the Smart Tweak feature for unloading certain translations is limited to logged-in users only. Now you can also set a custom capability for the current active user. The default is manage_options which is unique to the Administrator role. You can set this to anything you want via the filter function:

This code snippet goes into a core functionality plugin, or into Code Snippets.

if ( function_exists( 'tbex_capability_unloading_translations' ) ) :

  add_filter( 'tbex_filter_capability_unloading_translations', 'tbex_capability_unloading_translations' );
   * Set a custom capability for the Smart Tweak feature for unloading certain translations.
   *   This filter is available since Toolbar Extras version 1.3.9
   * @author David Decker - DECKERWEB
   * @link
   * @param string $capability String ID for capability.
   * @return string Modified string ID for capability.
  function tbex_capability_unloading_translations( $capability ) {

    return 'edit_posts';
  }  // end function


Where Do I Put Code Snippets?

Published on: // Last updated on: // All information without guarantee. Changes and errors excepted.