You appear to be a bot. Output may be restricted
Description
Usage
WPCOM_JSON_API_Update_Site_Homepage_Endpoint::callback( $path, $site_id );
Parameters
- $path
- ( mixed ) optional –
- $site_id
- ( mixed ) optional –
Returns
void
Source
File name: jetpack/json-endpoints/class.wpcom-json-api-update-site-homepage-endpoint.php
Lines:
1 to 29 of 29
function callback( $path = '', $site_id = 0 ) { $blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $site_id ) ); if ( is_wp_error( $blog_id ) ) { return $blog_id; } if ( ! current_user_can( 'edit_theme_options' ) ) { return new WP_Error( 'unauthorized', 'User is not authorized to access homepage settings', 403 ); } $args = $this->input(); if ( empty( $args ) || ! is_array( $args ) ) { return $this->get_current_settings(); } if ( isset( $args['is_page_on_front'] ) ) { $show_on_front = $args['is_page_on_front'] ? 'page' : 'posts'; update_option( 'show_on_front', $show_on_front ); } if ( isset( $args['page_on_front_id'] ) ) { update_option( 'page_on_front', $args['page_on_front_id'] ); } if ( isset( $args['page_for_posts_id'] ) ) { update_option( 'page_for_posts', $args['page_for_posts_id'] ); } return $this->get_current_settings(); }