wppaste
WordPress

WP_Internal_Pointers

Since
3.3.0
Source
wp-admin/includes/class-wp-internal-pointers.php:15
Core class used to implement an internal admin pointers API.

Compatibility

WordPress
since 3.3.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).

Methods · 14

Source code

#[AllowDynamicProperties]final class WP_Internal_Pointers {	/**	 * Initializes the new feature pointers.	 *	 * @since 3.3.0	 *	 * All pointers can be disabled using the following:	 *     remove_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );	 *	 * Individual pointers (e.g. wp390_widgets) can be disabled using the following:	 *	 *    function yourprefix_remove_pointers() {	 *        remove_action(	 *            'admin_print_footer_scripts',	 *            array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' )	 *        );	 *    }	 *    add_action( 'admin_enqueue_scripts', 'yourprefix_remove_pointers', 11 );	 *	 * @param string $hook_suffix The current admin page.	 */	public static function enqueue_scripts( $hook_suffix ) {		/*		 * Register feature pointers		 *		 * Format:		 *     array(		 *         hook_suffix => pointer callback		 *     )		 *		 * Example:		 *     array(		 *         'themes.php' => 'wp390_widgets'		 *     )		 */		$registered_pointers = array(			// None currently.		); 		// Check if screen related pointer is registered.		if ( empty( $registered_pointers[ $hook_suffix ] ) ) {			return;		} 		$pointers = (array) $registered_pointers[ $hook_suffix ]; 		/*		 * Specify required capabilities for feature pointers		 *		 * Format:		 *     array(		 *         pointer callback => Array of required capabilities		 *     )		 *		 * Example:		 *     array(		 *         'wp390_widgets' => array( 'edit_theme_options' )		 *     )		 */		$caps_required = array(			// None currently.		); 		// Get dismissed pointers.		$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); 		$got_pointers = false;		foreach ( array_diff( $pointers, $dismissed ) as $pointer ) {			if ( isset( $caps_required[ $pointer ] ) ) {				foreach ( $caps_required[ $pointer ] as $cap ) {					if ( ! current_user_can( $cap ) ) {						continue 2;					}				}			} 			// Bind pointer print function.			add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );			$got_pointers = true;

Changelog

Introduced in 3.3.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 7.0.4 tag, from src/wp-admin/includes/class-wp-internal-pointers.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.