Inspecting WP_Rest_Request

As noted above in Sally CJ’s comment, and as seen in the Wp Codebase, those are protected properties, so they are meant to be accessed only through the multiple get and set methods that the class exposes: /** * Sets the header on request. * * @since 4.4.0 * * @param string $key Header name. … Read more

Custom endpoint filtering post by custom taxonomies

Solved!!! A friend of my found the way function get_latest_posts_by_term($request) { $parsed_args=[ ‘numberposts’ => 20, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘tax_query’ => array( array ( ‘taxonomy’ => $request[‘slug’], ‘field’ => ‘slug’, ‘terms’ => $request->get_param(‘name’), ) ), ]; $get_posts = new WP_Query; $posts= $get_posts->query( $parsed_args ); //$posts = get_posts($args); if (empty($posts)) { … Read more