Yoast\WP\SEO\Conditionals
Robots_Txt_Conditional::is_file_editor_page
Returns whether the current page is the file editor page.
This checks for two locations:
- Multisite network admin file editor page
- Single site file editor page (under tools)
Метод класса: Robots_Txt_Conditional{}
Хуков нет.
Возвращает
true|false.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->is_file_editor_page();
Код Robots_Txt_Conditional::is_file_editor_page() Robots Txt Conditional::is file editor page Yoast 27.7
protected function is_file_editor_page() {
global $pagenow;
if ( $pagenow !== 'admin.php' ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_files' && \is_multisite() && \is_network_admin() ) {
return true;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( ! ( isset( $_GET['page'] ) && $_GET['page'] === 'wpseo_tools' ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification -- This is not a form.
if ( isset( $_GET['tool'] ) && $_GET['tool'] === 'file-editor' ) {
return true;
}
return false;
}