* Modify the URL to the feature settings, for example Publicize.
* Sharing is included here because while we still have a page in WP Admin,
* we prefer to send users to Calypso.
* @param string $feature Feature.
* @param string $configure_url URL to configure feature.
private function get_configure_url( $feature, $configure_url ) {
$configure_url = Redirect::get_url( 'calypso-marketing-connections' );
$configure_url = Redirect::get_url(
'calypso-marketing-traffic',
$configure_url = Redirect::get_url(
'calypso-marketing-traffic',
$configure_url = Redirect::get_url( 'wpcom-ads-settings' );
* Put some more appropriate links on our custom result cards.
* @param array $links Related links.
* @param array $plugin Plugin result information.
public function insert_module_related_links( $links, $plugin ) {
if ( self::$slug !== $plugin['slug'] ) {
// By the time this filter is applied, self_admin_url was already applied and we don't need it anymore.
remove_filter( 'self_admin_url', array( $this, 'plugin_details' ) );
if ( 'sharing-block' === $plugin['module'] ) {
$links['jp_get_started'] = '<a
id="plugin-select-settings"
class="jetpack-plugin-search__primary jetpack-plugin-search__get-started button"
href="' . esc_url( admin_url( 'site-editor.php?path=%2Fwp_template' ) ) . '"
data-module="' . esc_attr( $plugin['module'] ) . '"
>' . esc_html__( 'Add block', 'jetpack' ) . '</a>';
} elseif ( 'akismet' === $plugin['module'] || 'vaultpress' === $plugin['module'] ) {
$links['jp_get_started'] = '<a
id="plugin-select-settings"
class="jetpack-plugin-search__primary jetpack-plugin-search__get-started button"
href="' . esc_url( Redirect::get_url( 'plugin-hint-learn-' . $plugin['module'] ) ) . '"
data-module="' . esc_attr( $plugin['module'] ) . '"
>' . esc_html__( 'Get started', 'jetpack' ) . '</a>';
// Jetpack installed, active, feature not enabled; prompt to enable.
current_user_can( 'jetpack_activate_modules' ) &&
! Jetpack::is_module_active( $plugin['module'] ) &&
Jetpack_Plan::supports( $plugin['module'] )
id="plugin-select-activate"
class="jetpack-plugin-search__primary button"
data-module="' . esc_attr( $plugin['module'] ) . '"
data-configure-url="' . esc_url( $this->get_configure_url( $plugin['module'], $plugin['configure_url'] ) ) . '"
> ' . esc_html__( 'Enable', 'jetpack' ) . '</button>';
// Jetpack installed, active, feature enabled; link to settings.
! empty( $plugin['configure_url'] ) &&
current_user_can( 'jetpack_configure_modules' ) &&
Jetpack::is_module_active( $plugin['module'] ) &&
/** This filter is documented in class.jetpack-admin.php */
apply_filters( 'jetpack_module_configurable_' . $plugin['module'], false )
id="plugin-select-settings"
class="jetpack-plugin-search__primary button jetpack-plugin-search__configure"
href="' . esc_url( $this->get_configure_url( $plugin['module'], $plugin['configure_url'] ) ) . '"
data-module="' . esc_attr( $plugin['module'] ) . '"
>' . esc_html__( 'Configure', 'jetpack' ) . '</a>';
// Module is active, doesn't have options to configure.
} elseif ( Jetpack::is_module_active( $plugin['module'] ) ) {
$links['jp_get_started'] = '<a
id="plugin-select-settings"
class="jetpack-plugin-search__primary jetpack-plugin-search__get-started button"
href="' . esc_url( Redirect::get_url( 'plugin-hint-learn-' . $plugin['module'] ) ) . '"
data-module="' . esc_attr( $plugin['module'] ) . '"
>' . esc_html__( 'Get started', 'jetpack' ) . '</a>';
// Add link pointing to a relevant doc page in jetpack.com only if the Get started button isn't displayed.
if ( ! empty( $plugin['learn_more_button'] ) && ! isset( $links['jp_get_started'] ) ) {
class="jetpack-plugin-search__learn-more"
href="' . esc_url( $plugin['learn_more_button'] ) . '"
data-module="' . esc_attr( $plugin['module'] ) . '"
>' . esc_html__( 'Learn more', 'jetpack' ) . '</a>';
class="jetpack-plugin-search__dismiss"
data-module="' . esc_attr( $plugin['module'] ) . '"
>' . esc_html__( 'Hide this suggestion', 'jetpack' ) . '</a>';
* Master control that checks if Plugin search hints is active.
* @return bool True if PSH is active.
function jetpack_is_psh_active() {
* Disables the Plugin Search Hints feature found when searching the plugins page.
* @param bool Set false to disable the feature.
return apply_filters( 'jetpack_psh_active', true );