relevanssi_tabs

apply_filters( 'relevanssi_tabs', array $tabs )

This filter hook filters the Relevanssi admin interface tabs.

Parameters

$tabs
(array) An array of tab items.

More information

Relevanssi constructs the Relevanssi settings page tabs from an array of tab items. This approach makes it easier to change how the tabs appear, and for example, the Snowball Stemmer can add a new tab to the settings page.

The format of the individual tab items is this:

  • slug – used in URL and CSS class
  • name – the user-visible name
  • require – the file that contains tab code, to require_once (optional)
  • callback – the name of the function that renders the tab
  • save – if true, show the save button

The primary use for this filter hook is to add new tabs to the Relevanssi settings. You can also use this filter hook to give the site users access to some features of Relevanssi, but not all. For example, you could provide your editors access to the synonym feature, but nothing else.

// First give editors access to the Relevanssi settings page.
add_filter( 'relevanssi_options_capability', function() { return 'edit_others_posts'; } );

// Then remove all tabs except "synonyms".
add_filter( 'relevanssi_tabs', 'rlv_editor_access' );
function rlv_editor_access( $tabs ) {
  return array_filter( $tabs, function( $tab ) { return 'synonyms' === $tab['slug']; } );
}