search blog posts by author first name and or last name

Actually, when you set author_name, WP_Query will use get_user_by( ‘slug’, <author name> ) to find a user with the specified “nice name” (user_nicename) value, and if found, then WP_Query sets the author arg to the found user’s ID. Therefore you can follow the same approach, but you would use get_users() to find users having the … Read more

set_query_params using custom params defined in functions file?

it just seems to be ignoring only the custom parameters I have defined in my functions file There are two issues in your code: WP_REST_Request::set_query_params() actually accepts just one parameter, which is an array of arguments, so your code should look like so: $request->set_query_params([ // pass a single array containing one or more arguments ‘per_page’ … Read more

Is there a way to download only the Rest API part of WordPress?

WP REST API depends on WordPress, as it is just another interface for interacting with its other APIs. If BackPress (https://backpress.org/) was still in development, you could have had some chance with it, but it seems the project is abandoned. The plugin that was merged with WordPress Core is available here: https://github.com/WP-API/WP-API but is also … Read more

Multiple requests external data api dynamic block gutenberg

You could use transients: function requestApi() { $cache_key = ‘your_transient_name’; $values = get_transient( $cache_key ); // if no data in the cache if ( $values === false ) { // build the URL for wp_remote_get() function $arguments = [ ‘method’ => ‘GET’, ]; $request = wp_remote_get( ‘https://example.com.br/api/endpoint/product-id’, $arguments ); if ( !is_wp_error( $request ) && … Read more

How to create WordPress custom end point with multiple parameters?

When you register a route, parameters accepted via the query string (eg. ?a=b&c=d) are not registered as part of the endpoint, like you have done. Those parameters just need to be defined in the args property: add_action( ‘rest_api_init’, function() { register_rest_route( ‘woo/v2’, ‘woocommerce/order_summary_by_date’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘woocommerce_orders_by_dates’ ‘args’ => array( ‘start_date’ => … Read more