background_color

Definition:
function background_color() {}

Display background color value.

Source code

function background_color() {

	echo get_background_color();

}

553

avoid_blog_page_permalink_collision

Definition:
function avoid_blog_page_permalink_collision( $data, $postarr ) {}

Parameters

  • $data
  • $postarr

Source code

function avoid_blog_page_permalink_collision( $data, $postarr ) {

	if ( is_subdomain_install() )

		return $data;

	if ( $data['post_type'] != 'page' )

		return $data;

	if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )

		return $data;

	if ( !is_main_site() )

		return $data;



	$post_name = $data['post_name'];

	$c = 0;

	while( $c < 10 && get_id_from_blogname( $post_name ) ) {

		$post_name .= mt_rand( 1, 10 );

		$c ++;

	}

	if ( $post_name != $data['post_name'] ) {

		$data['post_name'] = $post_name;

	}

	return $data;

}

551

automatic_feed_links

Definition:
function automatic_feed_links( $add = true ) {}

Enable/disable automatic general feed link outputting.

Parameters

  • boolean $add: Optional, default is true. Add or remove links. Defaults to true.

Source code

function automatic_feed_links( $add = true ) {

	_deprecated_function( __FUNCTION__, '3.0', "add_theme_support( 'automatic-feed-links' )" );



	if ( $add )

		add_theme_support( 'automatic-feed-links' );

	else

		remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+

}

549

auth_redirect

Definition:
function auth_redirect() {}

Checks if a user is logged in, if not it redirects them to the login page.

Defined filters

  • secure_auth_redirect
    apply_filters('secure_auth_redirect', $secure)
  • auth_redirect_scheme
    apply_filters( 'auth_redirect_scheme', '' )

Defined actions

  • auth_redirect
    do_action('auth_redirect', $user_id);

Source code

function auth_redirect() {

	// Checks if a user is logged in, if not redirects them to the login page



	$secure = ( is_ssl() || force_ssl_admin() );



	$secure = apply_filters('secure_auth_redirect', $secure);



	// If https is required and request is http, redirect

	if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {

		if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {

			wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));

			exit();

		} else {

			wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);

			exit();

		}

	}



	if ( is_user_admin() )

		$scheme = 'logged_in';

	else

		$scheme = apply_filters( 'auth_redirect_scheme', '' );



	if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {

		do_action('auth_redirect', $user_id);



		// If the user wants ssl but the session is not ssl, redirect.

		if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {

			if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {

				wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));

				exit();

			} else {

				wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);

				exit();

			}

		}



		return;  // The cookie is good so we're done

	}



	// The cookie is no good so force login

	nocache_headers();



	if ( is_ssl() )

		$proto = 'https://';

	else

		$proto = 'http://';



	$redirect = ( strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ) ? wp_get_referer() : $proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];



	$login_url = wp_login_url($redirect, true);



	wp_redirect($login_url);

	exit();

}

547

author_can

Definition:
function author_can( $post, $capability ) {}

Whether author of supplied post has capability or role.

Parameters

  • int|object $post: Post ID or post object.
  • string $capability: Capability or role name.

Source code

function author_can( $post, $capability ) {

	if ( !$post = get_post($post) )

		return false;



	$author = new WP_User( $post->post_author );



	if ( empty( $author->ID ) )

		return false;



	$args = array_slice( func_get_args(), 2 );

	$args = array_merge( array( $capability ), $args );



	return call_user_func_array( array( &$author, 'has_cap' ), $args );

}

545