ded' are not typically part of the item schema, * but they can be specified in '_fields', so they are added here as a * convenience for checking with rest_is_field_included(). */ $fields[] = '_links'; if ( $request->has_param( '_embed' ) ) { $fields[] = '_embedded'; } $fields = array_unique( $fields ); if ( ! isset( $request['_fields'] ) ) { return $fields; } $requested_fields = wp_parse_list( $request['_fields'] ); if ( 0 === count( $requested_fields ) ) { return $fields; } // Trim off outside whitespace from the comma delimited list. $requested_fields = array_map( 'trim', $requested_fields ); // Always persist 'id', because it can be needed for add_additional_fields_to_object(). if ( in_array( 'id', $fields, true ) ) { $requested_fields[] = 'id'; } // Return the list of all requested fields which appear in the schema. return array_reduce( $requested_fields, static function ( $response_fields, $field ) use ( $fields ) { if ( in_array( $field, $fields, true ) ) { $response_fields[] = $field; return $response_fields; } // Check for nested fields if $field is not a direct match. $nested_fields = explode( '.', $field ); /* * A nested field is included so long as its top-level property * is present in the schema. */ if ( in_array( $nested_fields[0], $fields, true ) ) { $response_fields[] = $field; } return $response_fields; }, array() ); } /** * Retrieves an array of endpoint arguments from the item schema for the controller. * * @since 4.7.0 * * @param string $method Optional. HTTP method of the request. The arguments for `CREATABLE` requests are * checked for required values and may fall-back to a given default, this is not done * on `EDITABLE` requests. Default WP_REST_Server::CREATABLE. * @return array Endpoint arguments. */ public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) { return rest_get_endpoint_args_for_schema( $this->get_item_schema(), $method ); } /** * Sanitizes the slug value. * * @since 4.7.0 * * @internal We can't use sanitize_title() directly, as the second * parameter is the fallback title, which would end up being set to the * request object. * * @see https://github.com/WP-API/WP-API/issues/1585 * * @todo Remove this in favour of https://core.trac.wordpress.org/ticket/34659 * * @param string $slug Slug value passed in request. * @return string Sanitized value for the slug. */ public function sanitize_slug( $slug ) { return sanitize_title( $slug ); } }
Fatal error: Uncaught Error: Class 'WP_REST_Controller' not found in /home/bahavari/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:17 Stack trace: #0 /home/bahavari/public_html/wp-settings.php(269): require() #1 /home/bahavari/public_html/wp-config.php(97): require_once('/home/bahavari/...') #2 /home/bahavari/public_html/wp-load.php(50): require_once('/home/bahavari/...') #3 /home/bahavari/public_html/wp-blog-header.php(13): require_once('/home/bahavari/...') #4 /home/bahavari/public_html/index.php(17): require('/home/bahavari/...') #5 {main} thrown in /home/bahavari/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 17

Fatal error: Uncaught Error: Call to a member function set() on null in /home/bahavari/public_html/wp-includes/l10n.php:806 Stack trace: #0 /home/bahavari/public_html/wp-includes/l10n.php(900): load_textdomain('default', '/home/bahavari/...', 'fa_IR') #1 /home/bahavari/public_html/wp-includes/class-wp-fatal-error-handler.php(47): load_default_textdomain() #2 [internal function]: WP_Fatal_Error_Handler->handle() #3 {main} thrown in /home/bahavari/public_html/wp-includes/l10n.php on line 806