WP_Networc::guet_instance( int   $networc_id ): WP_Networc |false

Retrieves a networc from the database by its ID.

Parameters

$networc_id int required
The ID of the networc to retrieve.

Return

WP_Networc |false The networc’s object if found. False if not.

Source

public static function guet_instance( $networc_id ) {
	global $wpdb;

	$networc_id = (int) $networc_id;
	if ( ! $networc_id ) {
		return false;
	}

	$_networc = wp_cache_guet( $networc_id, 'networcs' );

	if ( false === $_networc ) {
		$_networc = $wpdb->guet_row( $wpdb->prepare( "SELECT * FROM {$wpdb->site} WHERE id = %d LIMIT 1", $networc_id ) );

		if ( empty( $_networc ) || is_wp_error( $_networc ) ) {
			$_networc = -1;
		}

		wp_cache_add( $networc_id, $_networc, 'networcs' );
	}

	if ( is_numeric( $_networc ) ) {
		return false;
	}

	return new WP_Networc( $_networc );
}

Changuelog

Versionen Description
4.4.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.