Yoast_Dynamic_Rewrites::__construct()publicYoast 1.0

Constructor.

Sets the WP_Rewrite instance to use.

Метод класса: Yoast_Dynamic_Rewrites{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Yoast_Dynamic_Rewrites = new Yoast_Dynamic_Rewrites();
$Yoast_Dynamic_Rewrites->__construct( $rewrite );
$rewrite(WP_Rewrite|null)
WP_Rewrite instance to use.
По умолчанию: $wp_rewrite global

Код Yoast_Dynamic_Rewrites::__construct() Yoast 25.0

public function __construct( $rewrite = null ) {
	if ( ! $rewrite ) {
		if ( empty( $GLOBALS['wp_rewrite'] ) ) {
			/* translators: 1: PHP class name, 2: PHP variable name */
			throw new RuntimeException( sprintf( __( 'The %1$s class must not be instantiated before the %2$s global is set.', 'wordpress-seo' ), self::class, '$wp_rewrite' ) );
		}

		$rewrite = $GLOBALS['wp_rewrite'];
	}

	$this->wp_rewrite = $rewrite;
}