get_nav_menu_locations

Definition:
function get_nav_menu_locations() {}

Returns an array with the registered navigation menu locations and the menu assigned to it

Source code

function get_nav_menu_locations() {

	return get_theme_mod( 'nav_menu_locations' );

}

1494

get_mu_plugins

Definition:
function get_mu_plugins() {}

Check the mu-plugins directory and retrieve all mu-plugin files with any plugin data.
WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins).

Return values

returns:Key is the mu-plugin file path and the value is an array of the mu-plugin data.

Source code

function get_mu_plugins() {

	$wp_plugins = array();

	// Files in wp-content/mu-plugins directory

	$plugin_files = array();



	if ( ! is_dir( WPMU_PLUGIN_DIR ) )

		return $wp_plugins;

	if ( $plugins_dir = @ opendir( WPMU_PLUGIN_DIR ) ) {

		while ( ( $file = readdir( $plugins_dir ) ) !== false ) {

			if ( substr( $file, -4 ) == '.php' )

				$plugin_files[] = $file;

		}

	} else {

		return $wp_plugins;

	}



	@closedir( $plugins_dir );



	if ( empty($plugin_files) )

		return $wp_plugins;



	foreach ( $plugin_files as $plugin_file ) {

		if ( !is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) )

			continue;



		$plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached.



		if ( empty ( $plugin_data['Name'] ) )

			$plugin_data['Name'] = $plugin_file;



		$wp_plugins[ $plugin_file ] = $plugin_data;

	}



	if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php') <= 30 ) // silence is golden

		unset( $wp_plugins['index.php'] );



	uasort( $wp_plugins, '_sort_uname_callback' );



	return $wp_plugins;

}

1492

get_most_recent_post_of_user

Definition:
function get_most_recent_post_of_user( $user_id ) {}

Get a user’s most recent post.
Walks through each of a user’s blogs to find the post with the most recent post_date_gmt.

Parameters

  • int $user_id

Return values

returns:Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts

Source code

function get_most_recent_post_of_user( $user_id ) {

	global $wpdb;



	$user_blogs = get_blogs_of_user( (int) $user_id );

	$most_recent_post = array();



	// Walk through each blog and get the most recent post

	// published by $user_id

	foreach ( (array) $user_blogs as $blog ) {

		$recent_post = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$wpdb->base_prefix}{$blog->userblog_id}_posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A);

1490

get_most_active_blogs

Definition:
function get_most_active_blogs( $num = 10, $display = true ) {}

Parameters

  • $num
  • $display

Source code

function get_most_active_blogs( $num = 10, $display = true ) {

	_deprecated_function( __FUNCTION__, '3.0' );



	$blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details

	if ( is_array( $blogs ) ) {

		reset( $blogs );

		foreach ( (array) $blogs as $key => $details ) {

			$most_active[ $details['blog_id'] ] = $details['postcount'];

			$blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!

		}

		arsort( $most_active );

		reset( $most_active );

		foreach ( (array) $most_active as $key => $details )

			$t[ $key ] = $blog_list[ $key ];



		unset( $most_active );

		$most_active = $t;

	}



	if ( $display == true ) {

		if ( is_array( $most_active ) ) {

			reset( $most_active );

			foreach ( (array) $most_active as $key => $details ) {

				$url = esc_url('http://' . $details['domain'] . $details['path']);

				echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";

			}

		}

	}

	return array_slice( $most_active, 0, $num );

}

1488

get_month_link

Definition:
function get_month_link($year, $month) {}

Retrieve the permalink for the month archives with year.

Parameters

  • bool|int $year: False for current year. Integer of year.
  • bool|int $month: False for current month. Integer of month.

Defined filters

  • month_link
    apply_filters('month_link', home_url( user_trailingslashit($monthlink, 'month')
  • month_link
    apply_filters('month_link', home_url( '?m=' . $year . zeroise($month, 2)

Source code

function get_month_link($year, $month) {

	global $wp_rewrite;

	if ( !$year )

		$year = gmdate('Y', current_time('timestamp'));

	if ( !$month )

		$month = gmdate('m', current_time('timestamp'));

	$monthlink = $wp_rewrite->get_month_permastruct();

	if ( !empty($monthlink) ) {

		$monthlink = str_replace('%year%', $year, $monthlink);

		$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);

		return apply_filters('month_link', home_url( user_trailingslashit($monthlink, 'month') ), $year, $month);

	} else {

		return apply_filters('month_link', home_url( '?m=' . $year . zeroise($month, 2) ), $year, $month);

	}

}

1486