WPSEO_Admin::add_action_link()
Adds links to Premium Support and FAQ under the plugin in the plugin overview page.
Метод класса: WPSEO_Admin{}
Хуков нет.
Возвращает
Массив
.
Использование
$WPSEO_Admin = new WPSEO_Admin(); $WPSEO_Admin->add_action_link( $links, $file );
- $links(массив) (обязательный)
- Array of links for the plugins, adapted when the current plugin is found.
- $file(строка) (обязательный)
- The filename for the current plugin, which the filter loops through.
Код WPSEO_Admin::add_action_link() WPSEO Admin::add action link Yoast 23.4
public function add_action_link( $links, $file ) { $first_time_configuration_notice_helper = YoastSEO()->helpers->first_time_configuration_notice; if ( $file === WPSEO_BASENAME && WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) { if ( is_network_admin() ) { $settings_url = network_admin_url( 'admin.php?page=' . self::PAGE_IDENTIFIER ); } else { $settings_url = admin_url( 'admin.php?page=' . self::PAGE_IDENTIFIER ); } $settings_link = '<a href="' . esc_url( $settings_url ) . '">' . __( 'Settings', 'wordpress-seo' ) . '</a>'; array_unshift( $links, $settings_link ); } // Add link to docs. $faq_link = '<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1yc' ) ) . '" target="_blank">' . __( 'FAQ', 'wordpress-seo' ) . '</a>'; array_unshift( $links, $faq_link ); if ( $first_time_configuration_notice_helper->first_time_configuration_not_finished() && ! is_network_admin() ) { $configuration_title = ( ! $first_time_configuration_notice_helper->should_show_alternate_message() ) ? 'first-time configuration' : 'SEO configuration'; /* translators: CTA to finish the first time configuration. %s: Either first-time SEO configuration or SEO configuration. */ $message = sprintf( __( 'Finish your %s', 'wordpress-seo' ), $configuration_title ); $ftc_link = '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_dashboard#top#first-time-configuration' ) ) . '" target="_blank">' . $message . '</a>'; array_unshift( $links, $ftc_link ); } $addon_manager = new WPSEO_Addon_Manager(); if ( YoastSEO()->helpers->product->is_premium() ) { // Remove Free 'deactivate' link if Premium is active as well. We don't want users to deactivate Free when Premium is active. unset( $links['deactivate'] ); $no_deactivation_explanation = '<span style="color: #32373c">' . sprintf( /* translators: %s expands to Yoast SEO Premium. */ __( 'Required by %s', 'wordpress-seo' ), 'Yoast SEO Premium' ) . '</span>'; array_unshift( $links, $no_deactivation_explanation ); if ( $addon_manager->has_valid_subscription( WPSEO_Addon_Manager::PREMIUM_SLUG ) ) { return $links; } // Add link to where premium can be activated. $activation_link = '<a style="font-weight: bold;" href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/activate-my-yoast' ) ) . '" target="_blank">' . __( 'Activate your subscription', 'wordpress-seo' ) . '</a>'; array_unshift( $links, $activation_link ); return $links; } // Add link to premium landing page. $premium_link = '<a style="font-weight: bold;" href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/1yb' ) ) . '" target="_blank" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2">' . __( 'Get Premium', 'wordpress-seo' ) . '</a>'; array_unshift( $links, $premium_link ); return $links; }