wppaste
WordPress

WP_Widget_Meta

Since
2.8.0
Source
wp-includes/widgets/class-wp-widget-meta.php:19
Core class used to implement a Meta widget.

Description

Displays log in/out, RSS feed links, etc.

Compatibility

WordPress
since 2.8.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 3

Every hook that fires from inside WP_Widget_Meta, in the order it appears in the class, grouped by the method that fires it.

Methods · 4

  • __construct()Sets up a new Meta widget instance.
  • widget()Outputs the content for the current Meta widget instance.
  • update()Handles updating settings for the current Meta widget instance.
  • form()Outputs the settings form for the Meta widget.

Source code

class WP_Widget_Meta extends WP_Widget { 	/**	 * Sets up a new Meta widget instance.	 *	 * @since 2.8.0	 */	public function __construct() {		$widget_ops = array(			'classname'                   => 'widget_meta',			'description'                 => __( 'Login, RSS, &amp; WordPress.org links.' ),			'customize_selective_refresh' => true,			'show_instance_in_rest'       => true,		);		parent::__construct( 'meta', __( 'Meta' ), $widget_ops );	} 	/**	 * Outputs the content for the current Meta widget instance.	 *	 * @since 2.8.0	 *	 * @param array $args     Display arguments including 'before_title', 'after_title',	 *                        'before_widget', and 'after_widget'.	 * @param array $instance Settings for the current Meta widget instance.	 */	public function widget( $args, $instance ) {		$default_title = __( 'Meta' );		$title         = ! empty( $instance['title'] ) ? $instance['title'] : $default_title; 		/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 		echo $args['before_widget']; 		if ( $title ) {			echo $args['before_title'] . $title . $args['after_title'];		} 		$format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; 		/** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */		$format = apply_filters( 'navigation_widgets_format', $format ); 		if ( 'html5' === $format ) {			// The title may be filtered: Strip out HTML and make sure the aria-label is never empty.			$title      = trim( strip_tags( $title ) );			$aria_label = $title ? $title : $default_title;			echo '<nav aria-label="' . esc_attr( $aria_label ) . '">';		}		?> 		<ul>			<?php wp_register(); ?>			<li><?php wp_loginout(); ?></li>			<li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries feed' ); ?></a></li>			<li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments feed' ); ?></a></li> 			<?php			/**			 * Filters the "WordPress.org" list item HTML in the Meta widget.			 *			 * @since 3.6.0			 * @since 4.9.0 Added the `$instance` parameter.			 *			 * @param string $html     Default HTML for the WordPress.org list item.			 * @param array  $instance Array of settings for the current widget.			 */			echo apply_filters(				'widget_meta_poweredby',				sprintf(					'<li><a href="%1$s">%2$s</a></li>',					esc_url( __( 'https://wordpress.org/' ) ),					__( 'WordPress.org' )				),				$instance			); 			wp_meta();			?>

Changelog

Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/widgets/class-wp-widget-meta.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.