Title: WP_Internal_Pointers
Published: April 25, 2014
Last modified: April 28, 2025

---

# class WP_Internal_Pointers {}

## In this article

 * [Methods](https://developer.wordpress.org/reference/classes/wp_internal_pointers/?output_format=md#methods)
 * [Source](https://developer.wordpress.org/reference/classes/wp_internal_pointers/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_internal_pointers/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_internal_pointers/?output_format=md#wp--skip-link--target)

Core class used to implement an internal admin pointers API.

## 󠀁[Methods](https://developer.wordpress.org/reference/classes/wp_internal_pointers/?output_format=md#methods)󠁿

| Name | Description | 
| [WP_Internal_Pointers::dismiss_pointers_for_new_users](https://developer.wordpress.org/reference/classes/wp_internal_pointers/dismiss_pointers_for_new_users/) | Prevents new users from seeing existing ‘new feature’ pointers. | 
| [WP_Internal_Pointers::enqueue_scripts](https://developer.wordpress.org/reference/classes/wp_internal_pointers/enqueue_scripts/) | Initializes the new feature pointers. | 
| [WP_Internal_Pointers::pointer_wp330_media_uploader](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp330_media_uploader/) | – | 
| [WP_Internal_Pointers::pointer_wp330_saving_widgets](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp330_saving_widgets/) | – | 
| [WP_Internal_Pointers::pointer_wp330_toolbar](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp330_toolbar/) | – | 
| [WP_Internal_Pointers::pointer_wp340_choose_image_from_library](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp340_choose_image_from_library/) | – | 
| [WP_Internal_Pointers::pointer_wp340_customize_current_theme_link](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp340_customize_current_theme_link/) | – | 
| [WP_Internal_Pointers::pointer_wp350_media](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp350_media/) | – | 
| [WP_Internal_Pointers::pointer_wp360_locks](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp360_locks/) | – | 
| [WP_Internal_Pointers::pointer_wp360_revisions](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp360_revisions/) | – | 
| [WP_Internal_Pointers::pointer_wp390_widgets](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp390_widgets/) | – | 
| [WP_Internal_Pointers::pointer_wp410_dfw](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp410_dfw/) | – | 
| [WP_Internal_Pointers::pointer_wp496_privacy](https://developer.wordpress.org/reference/classes/wp_internal_pointers/pointer_wp496_privacy/) | – | 
| [WP_Internal_Pointers::print_js](https://developer.wordpress.org/reference/classes/wp_internal_pointers/print_js/) | Prints the pointer JavaScript data. |

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_internal_pointers/?output_format=md#source)󠁿

    ```php
    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;
    		}

    		if ( ! $got_pointers ) {
    			return;
    		}

    		// Add pointers script and style to queue.
    		wp_enqueue_style( 'wp-pointer' );
    		wp_enqueue_script( 'wp-pointer' );
    	}

    	/**
    	 * Prints the pointer JavaScript data.
    	 *
    	 * @since 3.3.0
    	 *
    	 * @param string $pointer_id The pointer ID.
    	 * @param string $selector The HTML elements, on which the pointer should be attached.
    	 * @param array  $args Arguments to be passed to the pointer JS (see wp-pointer.js).
    	 */
    	private static function print_js( $pointer_id, $selector, $args ) {
    		if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) {
    			return;
    		}

    		?>
    		<script type="text/javascript">
    		(function($){
    			var options = <?php echo wp_json_encode( $args, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?>, setup;

    			if ( ! options )
    				return;

    			options = $.extend( options, {
    				close: function() {
    					$.post( ajaxurl, {
    						pointer: '<?php echo $pointer_id; ?>',
    						action: 'dismiss-wp-pointer'
    					});
    				}
    			});

    			setup = function() {
    				$('<?php echo $selector; ?>').first().pointer( options ).pointer('open');
    			};

    			if ( options.position && options.position.defer_loading )
    				$(window).bind( 'load.wp-pointers', setup );
    			else
    				$( function() {
    					setup();
    				} );

    		})( jQuery );
    		</script>
    		<?php
    	}

    	public static function pointer_wp330_toolbar() {}
    	public static function pointer_wp330_media_uploader() {}
    	public static function pointer_wp330_saving_widgets() {}
    	public static function pointer_wp340_customize_current_theme_link() {}
    	public static function pointer_wp340_choose_image_from_library() {}
    	public static function pointer_wp350_media() {}
    	public static function pointer_wp360_revisions() {}
    	public static function pointer_wp360_locks() {}
    	public static function pointer_wp390_widgets() {}
    	public static function pointer_wp410_dfw() {}
    	public static function pointer_wp496_privacy() {}

    	/**
    	 * Prevents new users from seeing existing 'new feature' pointers.
    	 *
    	 * @since 3.3.0
    	 *
    	 * @param int $user_id User ID.
    	 */
    	public static function dismiss_pointers_for_new_users( $user_id ) {
    		add_user_meta( $user_id, 'dismissed_wp_pointers', '' );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-internal-pointers.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/class-wp-internal-pointers.php#L16)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/class-wp-internal-pointers.php#L16-L175)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_internal_pointers/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_internal_pointers%2F)
before being able to contribute a note or feedback.