wp_rel_nofollow

Definition:
function wp_rel_nofollow( $text ) {}

Adds rel nofollow string to all HTML A elements in content.

Parameters

  • string $text: Content that may contain HTML A elements.

Return values

returns:Converted content.

Source code

function wp_rel_nofollow( $text ) {

	// This is a pre save filter, so text is already escaped.

	$text = stripslashes($text);

	$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);

	$text = esc_sql($text);

	return $text;

}

4029

wp_register_widget_control

Definition:
function wp_register_widget_control($id, $name, $control_callback, $options = array() {}

Registers widget control callback for customizing options.
The options contains the ‘height’, ‘width’, and ‘id_base’ keys. The ‘height’ option is never used. The ‘width’ option is the width of the fully expanded control form, but try hard to use the default width. The ‘id_base’ is for multi-widgets (widgets which allow multiple instances such as the text widget), an id_base must be provided. The widget id will end up looking like {$id_base}-{$unique_number}.

Parameters

  • int|string $id: Sidebar ID.
  • string $name: Sidebar display name.
  • callback $control_callback: Run when sidebar is displayed.
  • array|string $options: Optional. Widget options. See above long description.
  • mixed $params,…: Optional. Additional parameters to add to widget.

Source code

function wp_register_widget_control($id, $name, $control_callback, $options = array()) {

	global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;



	$id = strtolower($id);

	$id_base = _get_widget_id_base($id);



	if ( empty($control_callback) ) {

		unset($wp_registered_widget_controls[$id]);

		unset($wp_registered_widget_updates[$id_base]);

		return;

	}



	if ( in_array($control_callback, $_wp_deprecated_widgets_callbacks, true) && !is_callable($control_callback) ) {

		if ( isset($wp_registered_widgets[$id]) )

			unset($wp_registered_widgets[$id]);



		return;

	}



	if ( isset($wp_registered_widget_controls[$id]) && !did_action( 'widgets_init' ) )

		return;



	$defaults = array('width' => 250, 'height' => 200 ); // height is never used

	$options = wp_parse_args($options, $defaults);

	$options['width'] = (int) $options['width'];

	$options['height'] = (int) $options['height'];



	$widget = array(

		'name' => $name,

		'id' => $id,

		'callback' => $control_callback,

		'params' => array_slice(func_get_args(), 4)

	);

	$widget = array_merge($widget, $options);



	$wp_registered_widget_controls[$id] = $widget;



	if ( isset($wp_registered_widget_updates[$id_base]) )

		return;



	if ( isset($widget['params'][0]['number']) )

		$widget['params'][0]['number'] = -1;



	unset($widget['width'], $widget['height'], $widget['name'], $widget['id']);

	$wp_registered_widget_updates[$id_base] = $widget;

}

4027

wp_register_style

Definition:
function wp_register_style( $handle, $src, $deps = array() {}

Register CSS style file.

Parameters

  • string $handle: Name of the stylesheet.
  • string|bool $src: Path to the stylesheet from the root directory of WordPress. Example: ‘/css/mystyle.css’.
  • array $deps: Array of handles of any stylesheet that this stylesheet depends on. (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
  • string|bool $ver: String specifying the stylesheet version number. Set to NULL to disable. Used to ensure that the correct version is sent to the client regardless of caching.
  • string $media: The media for which this stylesheet has been defined.

Source code

function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {

	global $wp_styles;

	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {

		if ( ! did_action( 'init' ) )

			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),

				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );

		$wp_styles = new WP_Styles();

	}



	$wp_styles->add( $handle, $src, $deps, $ver, $media );

}

4025

wp_register_sidebar_widget

Definition:
function wp_register_sidebar_widget($id, $name, $output_callback, $options = array() {}

Register widget for use in sidebars.
The default widget option is ‘classname’ that can be override.

Parameters

  • int|string $id: Widget ID.
  • string $name: Widget display title.
  • callback $output_callback: Run when widget is called.
  • array|string $options: Optional. Widget Options.
  • mixed $params,…: Widget parameters to add to widget.

Return values

returns:Will return if $output_callback is empty after removing widget.

Defined actions

  • wp_register_sidebar_widget
    do_action( 'wp_register_sidebar_widget', $widget );

Source code

function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) {

	global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks;



	$id = strtolower($id);



	if ( empty($output_callback) ) {

		unset($wp_registered_widgets[$id]);

		return;

	}



	$id_base = _get_widget_id_base($id);

	if ( in_array($output_callback, $_wp_deprecated_widgets_callbacks, true) && !is_callable($output_callback) ) {

		if ( isset($wp_registered_widget_controls[$id]) )

			unset($wp_registered_widget_controls[$id]);



		if ( isset($wp_registered_widget_updates[$id_base]) )

			unset($wp_registered_widget_updates[$id_base]);



		return;

	}



	$defaults = array('classname' => $output_callback);

	$options = wp_parse_args($options, $defaults);

	$widget = array(

		'name' => $name,

		'id' => $id,

		'callback' => $output_callback,

		'params' => array_slice(func_get_args(), 4)

	);

	$widget = array_merge($widget, $options);



	if ( is_callable($output_callback) && ( !isset($wp_registered_widgets[$id]) || did_action( 'widgets_init' ) ) ) {

		do_action( 'wp_register_sidebar_widget', $widget );

		$wp_registered_widgets[$id] = $widget;

	}

}

4023

wp_register_script

Definition:
function wp_register_script( $handle, $src, $deps = array() {}

Register new Javascript file.

Parameters

  • string $handle: Script name
  • string $src: Script url
  • array $deps: (optional) Array of script names on which this script depends
  • string|bool $ver: (optional) Script version (used for cache busting), set to NULL to disable
  • bool $in_footer: (optional) Whether to enqueue the script before </head> or before </body>

Source code

function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {

	global $wp_scripts;

	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {

		if ( ! did_action( 'init' ) )

			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),

				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );

		$wp_scripts = new WP_Scripts();

	}



	$wp_scripts->add( $handle, $src, $deps, $ver );

	if ( $in_footer )

		$wp_scripts->add_data( $handle, 'group', 1 );

}

4021