set_default_params example

$request->set_url_params( $args );
                $request->set_attributes( $handler );

                $defaults = array();

                foreach ( $handler['args'] as $arg => $options ) {
                    if ( isset( $options['default'] ) ) {
                        $defaults[ $arg ] = $options['default'];
                    }
                }

                $request->set_default_params( $defaults );

                return array( $route$handler );
            }
        }

        return new WP_Error(
            'rest_no_route',
            __( 'No route was found matching the URL and request method.' ),
            array( 'status' => 404 )
        );
    }

    
Home | Imprint | This part of the site doesn't use cookies.