WPSEO_Post_Metabox_Formatter::base_url_for_js()
Returns a base URL for use in the JS, takes permalink structure into account.
Метод класса: WPSEO_Post_Metabox_Formatter{}
Хуков нет.
Возвращает
Строку
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->base_url_for_js();
Код WPSEO_Post_Metabox_Formatter::base_url_for_js() WPSEO Post Metabox Formatter::base url for js Yoast 22.4
private function base_url_for_js() { global $pagenow; // The default base is the home_url. $base_url = home_url( '/', null ); if ( $pagenow === 'post-new.php' ) { return $base_url; } // If %postname% is the last tag, just strip it and use that as a base. if ( preg_match( '#%postname%/?$#', $this->permalink ) === 1 ) { $base_url = preg_replace( '#%postname%/?$#', '', $this->permalink ); } // If %pagename% is the last tag, just strip it and use that as a base. if ( preg_match( '#%pagename%/?$#', $this->permalink ) === 1 ) { $base_url = preg_replace( '#%pagename%/?$#', '', $this->permalink ); } return $base_url; }