wp_xmlrpc_server::wp_getPage()
Retrieves a page.
Метод класса: wp_xmlrpc_server{}
Хуки из метода
Возвращает
Массив|IXR_Error
.
Использование
$wp_xmlrpc_server = new wp_xmlrpc_server(); $wp_xmlrpc_server->wp_getPage( $args );
- $args(массив) (обязательный)
Method arguments. Note: arguments must be ordered as documented.
-
0(int)
Blog ID (unused). -
1(int)
Page ID. -
2(строка)
Username. - 3(строка)
Password.
-
Список изменений
С версии 2.2.0 | Введена. |
Код wp_xmlrpc_server::wp_getPage() wp xmlrpc server::wp getPage WP 6.6.1
public function wp_getPage( $args ) { $this->escape( $args ); $page_id = (int) $args[1]; $username = $args[2]; $password = $args[3]; $user = $this->login( $username, $password ); if ( ! $user ) { return $this->error; } $page = get_post( $page_id ); if ( ! $page ) { return new IXR_Error( 404, __( 'Invalid post ID.' ) ); } if ( ! current_user_can( 'edit_page', $page_id ) ) { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this page.' ) ); } /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ do_action( 'xmlrpc_call', 'wp.getPage', $args, $this ); // If we found the page then format the data. if ( $page->ID && ( 'page' === $page->post_type ) ) { return $this->_prepare_page( $page ); } else { // If the page doesn't exist, indicate that. return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); } }