WC_Admin::admin_footer_text()publicWC 2.3

Change the admin footer text on WooCommerce admin pages.

Method of the class: WC_Admin{}

Return

String.

Usage

$WC_Admin = new WC_Admin();
$WC_Admin->admin_footer_text( $footer_text );
$footer_text(string) (required)
text to be rendered in the footer.

Changelog

Since 2.3 Introduced.

WC_Admin::admin_footer_text() code WC 8.6.1

public function admin_footer_text( $footer_text ) {
	if ( ! current_user_can( 'manage_woocommerce' ) || ! function_exists( 'wc_get_screen_ids' ) ) {
		return $footer_text;
	}
	$current_screen = get_current_screen();
	$wc_pages       = wc_get_screen_ids();

	// Set only WC pages.
	$wc_pages = array_diff( $wc_pages, array( 'profile', 'user-edit' ) );

	// Check to make sure we're on a WooCommerce admin page.
	if ( isset( $current_screen->id ) && apply_filters( 'woocommerce_display_admin_footer_text', in_array( $current_screen->id, $wc_pages, true ) ) ) {
		// Change the footer text.
		if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
			$footer_text = sprintf(
				/* translators: 1: WooCommerce 2:: five stars */
				__( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'woocommerce' ),
				sprintf( '<strong>%s</strong>', esc_html__( 'WooCommerce', 'woocommerce' ) ),
				'<a href="https://wordpress.org/support/plugin/woocommerce/reviews?rate=5#new-post" target="_blank" class="wc-rating-link" aria-label="' . esc_attr__( 'five star', 'woocommerce' ) . '" data-rated="' . esc_attr__( 'Thanks :)', 'woocommerce' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
			);
			wc_enqueue_js(
				"jQuery( 'a.wc-rating-link' ).on( 'click', function() {
					jQuery.post( '" . WC()->ajax_url() . "', { action: 'woocommerce_rated' } );
					jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
				});"
			);
		} else {
			$footer_text = __( 'Thank you for selling with WooCommerce.', 'woocommerce' );
		}
	}

	return $footer_text;
}